Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

babel-loader使用query的方式会报错 #505

Closed
qinshenxue opened this issue Nov 30, 2016 · 1 comment
Closed

babel-loader使用query的方式会报错 #505

qinshenxue opened this issue Nov 30, 2016 · 1 comment

Comments

@qinshenxue
Copy link

qinshenxue commented Nov 30, 2016

在vue文件中使用了es6语法后,运行没问题,但是使用webpack插件webpack.optimize.UglifyJsPlugin()的时候发现会报错
image
发现如果采用.babelrc来配置babel-loader的参数就不会报上面的错,而采用query的的方式就会上面的错:

{
    test: /\.js$/,
    loader: 'babel-loader?presets[]=es2015',
    exclude: /node_modules/
}

如果采用query的方式,然后把vue文件不采用最新的语法,也不会报错。

"devDependencies": {
    "vue": "^2.0.7",
    "vue-loader": "^9.9.5",
    "vue-router": "^2.0.2",
    "webpack": "^1.13.3",
    "webpack-dev-server": "^1.16.2",
    "css-loader":"^0.26.0",
    "url-loader":"^0.5.7",
    "file-loader":"^0.9.0",
    "less": "^2.3.1",
    "less-loader": "^2.2.3",
    "node-sass": "^3.4.2",
    "sass-loader": "^4.0.2",
    "stylus": "^0.54.5",
    "stylus-loader": "^2.4.0",
    "babel-core":"^6.0.0",
    "babel-loader":"^6.0.0",
    "babel-preset-es2015": "^6.0.0",
    "babel-plugin-transform-runtime":"^6.15.0"
  }

环境:win7 64bit
浏览器:chrome 54.0.2840.99 m (64-bit)

@yyx990803
Copy link
Member

Because the query only applies to babel-loader, not vue-loader. This is expected behavior.

Just use .babelrc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants