Mu class network front-end engineers Promotion Course Vue family bucket + SSR + Koa2 whole stack development US Mission Network
After the video npx create-nuxt-app mt-app to create a project, you can not use import ... from .... Webpack.js followed the teacher to modify in the file. amend as below
"scripts": { "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server --exec babel-node", //修改内容 --exec babel-node "build": "nuxt build", "start": "cross-env NODE_ENV=production node server/index.js --exec babel-node",//修改内容 --exec babel-node
"generate": "nuxt generate"
},
.Babeltc then create a file in the project directory, file configuration is as follows
{ "presets": ["es2015"] }
Then install npm install babel-preset-es2015, then run-time error occurs
$ npm run dev > [email protected] dev D:\text\vue\mt-app > cross-env NODE_ENV=development nodemon --exec babel-node server/index.js --watch server [nodemon] 1.19.1 [nodemon] to restart at any time, enter `rs` [nodemon] watching: D:\text\vue\mt-app\server/**/* [nodemon] starting `babel-node server/index.js` 'babel-node' ▒▒▒▒▒ڲ▒▒▒▒ⲿ▒▒▒Ҳ▒▒▒ǿ▒▒▒▒еij▒▒▒ ▒▒▒▒▒▒▒▒▒ļ▒▒▒ [nodemon] app crashed - waiting for file changes before starting...
Solution:
The installation requires the installation of two additional babel-core and babel-cli, namely: npm i babel-core babel-preset-es2015 babel-cli
problem solved