0👍
I struggle with a similar problem. That was the trick
https://github.com/SimulatedGREG/electron-vue/issues/200
0👍
You can try to install this version of uglify
, it called uglify-es
and it is:
JavaScript parser, mangler/compressor and beautifier toolkit for ES6+
In my case, I have installed babel
plugin to handle this issue.
If you want to try you should do this:
Add this to your package.json
"babel-core": "latest",
"babel-loader": "latest",
"babel-plugin-transform-async-to-generator": "latest",
"babel-plugin-transform-runtime": "latest",
"babel-preset-es2015": "latest",
"babel-runtime": "latest"
Set you webpack.config
file to be like (This is mine for example):
const path = require('path')
const webpack = require('webpack')
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
query: {
name: '[name].[ext]?[hash]'
}
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
}
]
}
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.optimize.UglifyJsPlugin({ sourceMap: true, compress: { warnings: false }})
])
}
Set your .babelrc
file to be like:
{
"presets": ["es2015"],
"plugins": ["transform-runtime", "transform-async-to-generator"]
}
Hope it helps 🙂
Source:stackexchange.com