我正在尝试运行npm run build,但是我无法做到这一点。
我正在使用webpack 2,但它在uglifyJs中给我一个ERROR
app.3e1e32973e47000acf37.js from UglifyJs
Unexpected token: keyword (function) [app.3e1e32973e47000acf37.js:130155,20]
ERROR in app.bundle.js from UglifyJs
这是我的package.json文件
"devDependencies": {
"angular-animate": "^1.6.4",
"angular-aria": "^1.6.4",
"angular-sanitize": "^1.6.4",
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"copy-webpack-plugin": "4.0.1",
"html-webpack-plugin": "^2.7.1",
"postcss-loader": "1.2.2",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.1",
"style-loader": "^0.13.0",
"webpack": "2.2.0",
"webpack-dev-server": "2.2.0"
}
"scripts": {
"build": "rimraf dist && webpack -p --bail --progress --profile",
"server": "webpack-dev-server --port 8080 --history-api-fallback --inline --progress",
"start": "npm run server"
},
这是我的webpack.config.js文件。
config.module = {
rules: [{
// JS LOADER
// Reference: https://github.com/babel/babel-loader
// Transpile .js files using babel-loader
// Compiles ES6 and ES7 into ES5 code
test: /\.js$/,
loader: 'babel-loader',**strong text**
exclude: /node_modules/
}
这是我的 Babel 文件
{
"presets": ["es2015"]
}
当我将webpack.config.js文件中的这个新test对象从js更改为es6时
config.module = {
rules: [{
// JS LOADER
// Reference: https://github.com/babel/babel-loader
// Transpile .js files using babel-loader
// Compiles ES6 and ES7 into ES5 code
test: /\.es6$/,
loader: 'babel-loader',**strong text**
exclude: /node_modules/
}
我在运行npm run build时遇到了一个错误,错误信息如下:在app.8c6dc5e29db45e3eb325.js文件的第5564行第32个字符出现了意外的符号: 操作符(>)。
请问我做错了什么?