为了账号安全,请及时绑定邮箱和手机立即绑定

build 报错

const path = require('path')

const {VueLoaderPlugin} = require('vue-loader')


module.exports = {

entry: path.join(__dirname, 'src/index.js'),

output: {

filename: 'bundle.js',

path: path.join(__dirname, 'dist')

},

module: {

rules: [

{

test: /.vue$/,

loader: 'vue-loader'

},

{

test: /.css$/,

loader: 'css-loader'

}

]

},

plugins: [

vue VueLoaderPlugin()

]

}

上面是代码,下面是报错

SyntaxError: Unexpected identifier

    at new Script (vm.js:80:7)

    at NativeCompileCache._moduleCompile (D:\网页\todo\node_modules\v8-compile-cache\v8-compile-cache.js:240:18)

    at Module._compile (D:\网页\todo\node_modules\v8-compile-cache\v8-compile-cache.js:186:36)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)

    at Module.load (internal/modules/cjs/loader.js:600:32)

    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)

    at Function.Module._load (internal/modules/cjs/loader.js:531:3)

    at Module.require (internal/modules/cjs/loader.js:637:17)

    at require (D:\网页\todo\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)

    at WEBPACK_OPTIONS (D:\网页\todo\node_modules\webpack-cli\bin\utils\convert-argv.js:115:13)

    at requireConfig (D:\网页\todo\node_modules\webpack-cli\bin\utils\convert-argv.js:117:6)

    at D:\网页\todo\node_modules\webpack-cli\bin\utils\convert-argv.js:124:17

    at Array.forEach (<anonymous>)

    at module.exports (D:\网页\todo\node_modules\webpack-cli\bin\utils\convert-argv.js:122:15)

    at yargs.parse (D:\网页\todo\node_modules\webpack-cli\bin\cli.js:71:45)

    at Object.parse (D:\网页\todo\node_modules\yargs\yargs.js:567:18)

    at D:\网页\todo\node_modules\webpack-cli\bin\cli.js:49:8

    at Object.<anonymous> (D:\网页\todo\node_modules\webpack-cli\bin\cli.js:375:3)

    at Module._compile (internal/modules/cjs/loader.js:701:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)

    at Module.load (internal/modules/cjs/loader.js:600:32)

    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)

    at Function.Module._load (internal/modules/cjs/loader.js:531:3)

    at Module.require (internal/modules/cjs/loader.js:637:17)

    at require (internal/modules/cjs/helpers.js:22:18)

    at Object.<anonymous> (D:\网页\todo\node_modules\webpack\bin\webpack.js:156:2)

    at Module._compile (internal/modules/cjs/loader.js:701:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)

    at Module.load (internal/modules/cjs/loader.js:600:32)

    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! todo@1.0.0 build: `webpack --config webpack.config.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the todo@1.0.0 build script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

npm ERR!     D:\nodejs\node_cache\_logs\2019-05-12T10_55_54_328Z-debug.log


正在回答

2 回答

// webpack.config.js
const VueLoaderPlugin = require('vue-loader/lib/plugin')
看官方文档怎么写的吧https://vue-loader.vuejs.org/guide/#manual-setup
0 回复 有任何疑惑可以回复我~

plugins: [

new VueLoaderPlugin()

]

看是不是这里写错了


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Vue+Webpack打造todo应用
  • 参与学习       84606    人
  • 解答问题       787    个

用前端最热门框架Vue+最火打包工具Webpack打造todo应用

进入课程

build 报错

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信