Solution: Install the plug-in to make NODE.JS support ES6 default import syntax
You can also use plug-ins to support es6
1.node.js terminal install plug-in
npm install --save-dev babel-preset- es2015 npm install --save-dev babel-register
2. Create a new .babelrc file, the configuration content is as follows
{ "presets": ["es2015" ], "plugins" : [] }
3. Join in the entry file of node
require( ‘babel-register’);
After my experiment, only the first two steps can solve the problem.
Similar Posts:
- Vue compatible ie error reporting solution
- For Vue, an error is reported in “exports is not defined” in webpack
- [Solved] Vue/cli install element error: Error: cannot find module ‘Babel plugin component’
- [Two Solutions] Syntax error: unexpected token import
- [Solved] app crashed – waiting for file changes before starting…
- vue ‘Couldn’t find preset “es2015” relative to directory’
- [Solved] react Project Error: Support for the experimental syntax ‘decorators-legacy’ isn’t currently enabled
- React uses antd to import error messages on demand
- [Solved] Mobx error: Support for the experimental syntax ‘decorators-legacy’ isn’t currently enab
- [Solved] Vue installation Babel dependency error