I have implemented the FlipClockJs vue component and it works fine when I run
yarn encore dev
However, as soon as I run
yarn encore production
I get the following error
ERROR Failed to compile with 1 errors12:30:24 PM
error
app.bc30a410.js from UglifyJs Unexpected token: operator (>) [app.bc30a410.js:12470,21]
I tried resolving this by adding this to my webpack file:
.addLoader({
test: /\.js$/,
loader: "babel-loader",
include: ['node_modules/@mvpleung/flipclock']
})
But this just gives me the same result. My entire webpack file looks like this:
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();
Any idea what might be wrong here? The component works fine when running yarn encore dev.
Using Vue 2.5.17
from babel-loader not working, giving error on UglifyJS (ES6)
No comments:
Post a Comment