繁体   English   中英

babel-loader无法正常工作,在UglifyJS(ES6)上出错

[英]babel-loader not working, giving error on UglifyJS (ES6)

我已经实现了FlipClockJs vue组件 ,它在我运行时工作正常

纱线安装开发

但是,一旦我跑了

纱线再生产

我收到以下错误

错误12:30:24 PM无法编译1个错误

错误

来自UglifyJs的app.bc30a410.js意外的令牌:运算符(>)[app.bc30a410.js:12470,21]

我尝试通过将其添加到我的webpack文件来解决这个问题:

  .addLoader({
    test: /\.js$/,
    loader: "babel-loader",
    include: ['node_modules/@mvpleung/flipclock']
  })

但这只是给了我相同的结果。 我的整个webpack文件如下所示:

 var Encore = require("@symfony/webpack-encore"); const { VueLoaderPlugin } = require("vue-loader"); const MinifyPlugin = require('babel-minify-webpack-plugin'); Encore.setOutputPath("public/build/") .setPublicPath("/build") .addEntry("app", "./resources/assets/js/app.js") .cleanupOutputBeforeBuild() .enableSourceMaps(!Encore.isProduction()) .enableVersioning(Encore.isProduction()) .addLoader({ test: /\\.vue$/, loader: "vue-loader" }) .addLoader({ test: /\\.js$/, loader: 'babel-loader', include: ['/node_modules/@mvpleung/flipclock'] }) .addLoader({ test: /\\.(js|vue)$/, enforce: "pre", loader: "eslint-loader", exclude: /node_modules/, options: { fix: true } }) .addPlugin(new VueLoaderPlugin()) .addPlugin(new MinifyPlugin()) .addAliases({ vue: "vue/dist/vue.js" }) .enableSassLoader() .enablePostCssLoader() ; module.exports = Encore.getWebpackConfig(); 

知道这里可能有什么问题吗? 运行纱线安装开发时,该组件工作正常。

使用Vue 2.5.17

尝试在配置中添加以下内容

  optimization: { minimize: false },

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM