错误模块构build失败,parsing与webpack中的UglifyJsPlugin错误

我有一个错误,我找不到解决scheme。

我在Docker中运行了一个新的VueJS项目。 它在开发模式下工作正常,但是当我尝试构build产品时失败。 错误包含在下面,似乎与eslint 。 我已经删除部分,直到它的工作,并缩小到UglifyJsPlugin ,但我不知道为什么。

我知道我可以删除Uglify进程,但我不想 – 我想解决这个问题!

错误是这样的:

 ERROR in ./~/vue-html-loader!./~/vue-loader/lib/selector.js?type=template&index=0!./~/eslint-loader!./src/components/UserInput.vue Module build failed: Error: Parse Error: <input class="form-control" type:"text" v-model="newTodoText" v-on:keyup.enter="createTodo" placeholder="New todo"> <span class="btn btn-primary input-group-addon" v-on:click="createTodo"> Add </span> </div> <div class="btn-group" role="group" aria-label="Second group"> <button type="button" class="btn btn-danger" v-on:click="showClearModal"> Clear all </button> </div> </div> <hr> <div id="clearModal" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> Are you sure you want do delete them all? </div> <div class="modal-body"> <p>This will permanently destroy all todos, do you really want to do this?</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <button class="btn btn-danger btn-ok" v-on:click="clearTodos">Delete</button> </div> </div> </div> </div> at new HTMLParser (/code/node_modules/html-minifier/src/htmlparser.js:236:13) at minify (/code/node_modules/html-minifier/src/htmlminifier.js:945:3) at Object.exports.minify (/code/node_modules/html-minifier/src/htmlminifier.js:1294:10) at Object.module.exports (/code/node_modules/vue-html-loader/index.js:85:26) @ ./src/components/UserInput.vue 4:19-173 

我的webpackconfiguration看起来像这样BASE:

 var path = require('path') var config = require('../config') var cssLoaders = require('./css-loaders') var projectRoot = path.resolve(__dirname, '../') var webpack = require('webpack') module.exports = { entry: { app: './src/main.js' }, output: { path: config.build.assetsRoot, publicPath: config.build.assetsPublicPath, filename: '[name].js' }, resolve: { extensions: ['', '.js', '.vue'], fallback: [path.join(__dirname, '../node_modules')], alias: { 'src': path.resolve(__dirname, '../src'), 'assets': path.resolve(__dirname, '../src/assets'), 'components': path.resolve(__dirname, '../src/components') } }, resolveLoader: { fallback: [path.join(__dirname, '../node_modules')] }, module: { preLoaders: [ { test: /\.vue$/, loader: 'eslint', include: projectRoot, exclude: /node_modules/ }, { test: /\.js$/, loader: 'eslint', include: projectRoot, exclude: /node_modules/ } ], loaders: [ { test: /\.vue$/, loader: 'vue' }, { test: /\.js$/, loader: 'babel', include: projectRoot, exclude: /node_modules/ }, { test: /\.json$/, loader: 'json' }, { test: /\.html$/, loader: 'vue-html' }, { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' }, { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file-loader' }, { test: /\.(png|jpe?g|gif|otf)(\?.*)?$/, loader: 'url', query: { limit: 10000, name: path.join(config.build.assetsSubDirectory, '[name].[hash:7].[ext]') } }, { test: /\.css$/, loaders: ['style-loader', 'css-loader'] } ] }, vue: { loaders: cssLoaders() }, plugins: [ new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery', Tether: 'tether' }) ], eslint: { formatter: require('eslint-friendly-formatter') } } 

和PROD

 var path = require('path') var config = require('../config') var webpack = require('webpack') var merge = require('webpack-merge') var baseWebpackConfig = require('./webpack.base.conf') var cssLoaders = require('./css-loaders') var ExtractTextPlugin = require('extract-text-webpack-plugin') var HtmlWebpackPlugin = require('html-webpack-plugin') module.exports = merge(baseWebpackConfig, { devtool: config.build.productionSourceMap ? '#source-map' : false, output: { path: config.build.assetsRoot, filename: path.join(config.build.assetsSubDirectory, '[name].[chunkhash].js'), chunkFilename: path.join(config.build.assetsSubDirectory, '[id].[chunkhash].js') }, vue: { loaders: cssLoaders({ sourceMap: config.build.productionSourceMap, extract: true }) }, plugins: [ // http://vuejs.github.io/vue-loader/workflow/production.html new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production'), API_HOST: JSON.stringify(config.prod.api_host) } }), new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false }, sourceMap: true }), new webpack.optimize.OccurenceOrderPlugin(), // extract css into its own file new ExtractTextPlugin(path.join(config.build.assetsSubDirectory, '[name].[contenthash].css')), // generate dist index.html with correct asset hash for caching. // you can customize output by editing /index.html // see https://github.com/ampedandwired/html-webpack-plugin new HtmlWebpackPlugin({ filename: process.env.NODE_ENV === 'testing' ? 'index.html' : config.build.index, template: 'index.html', inject: true, minify: { removeComments: true, collapseWhitespace: true, removeAttributeQuotes: true // more options: // https://github.com/kangax/html-minifier#options-quick-reference } }) ] }) 

我错过了什么?