【发布时间】:2019-02-26 04:32:32
【问题描述】:
这是在我的 webpack.base.conf.js 中
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
}
},
module: {
rules: [
{
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
options: {
formatter: require('eslint-friendly-formatter')
}
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test')]
},
当我使用这一行运行 webpack 时
webpack ./src/main.js --output ./dist
这是完整的错误:
ERROR in ./src/main.js 240:36
Module parse failed: Unexpected token (240:36)
You may need an appropriate loader to handle this file type.
| state.connection.lastUpdate = Date.now();
|
> state.currencies = {...information.currenciesInfo};
|
| state.trends = {...information.trends};
在我读到的其他网站上,它可能与 webpack 或一些附件问题有关。有没有人发现一个明显的问题?
我相信程序员使用了 webpack3,我从头开始构建 webpack4
输入赞赏
编辑:main.js
// information = information[0];
state.connection.lastUpdate = Date.now();
state.currencies = {...information.currenciesInfo};
state.trends = {...information.trends};
【问题讨论】:
-
你的 babelrc 配置是什么?你有其他预设设置为 babel-loader 吗?
-
{ "presets": [ ["env", { "modules": false, "targets": { "browsers": ["> 1%", "last 2 versions", "not即
-
您需要为传播算子预设
-
您能详细说明一下吗?扩展运算符是什么?非常感谢