当我尝试运行命令 npm run dev 时,却迷上了 npm run build 我认为我需要将传递参数传递给uglifyjs或vue-loader
将Babel预设设置为es2015无法解决问题
ERROR in build.js from UglifyJs
Unexpected token: operator (>) [./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/coffee/forms/table_class_selection.vue:28,44][build.js:19990,120]
我们使用这样的配置
module.exports = {
...
module: {
rules: [
{
test: /\.coffee$/,
use: {
loader: 'coffee-loader',
options: {
transpile: {
presets: ['env']
}
}
}
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
'scss': [
'vue-style-loader',
'css-loader',
'sass-loader'
],
'sass': [
'vue-style-loader',
'css-loader',
'sass-loader?indentedSyntax'
]
}
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}
...
]
}
...
}
Vue文件代码为
<template>
...
</template>
<script lang="coffee">
...
</script>
答案 0 :(得分:0)
解决方案是安装 npm 依赖项
{
"presets": [
["env", { "modules": false }],
"stage-3"
],
"plugins": ["transform-vue-jsx"]
}
并在以下几行中添加到 .babelrc
{{1}}