Answer the question
In order to leave comments, you need to log in
Why doesn't the code from the `highlight.js` npm package want to be aggregated in production? How to fix it?
In main.js I import, among other imports , highlight.js :
import hljs from 'highlight.js';
hljs.highlightAll();
...
.pipe(webpackStream({
mode: `${(devMode === true) ? 'development' : 'production'}`, // translate our mode for webpack
output: {
filename: `${path.build.jsOutput}`, // specify just one output file
},
module: {
rules: [
{
test: /\.(js)$/, // get all the js-files
exclude: /(node_modules)/, // exclude development modules folder
loader: 'babel-loader', // convert ES6 into a backwards compatible version of JS
query: {
presets: ['@babel/env'] // use babel preset
}
},
]
},
optimization: {
minimizer: [
new UglifyJsPlugin({ // minify JS
uglifyOptions: {
output: {
comments: false, // disable even special comments
},
},
}),
],
}
})).on('error', function handleError() {
this.emit('end')
})
...
ERROR in main.js from UglifyJs
Unexpected token: name «Response», expected: punc «;» [main.js:22946,6]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question