-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
SyntaxError: Invalid regular expression #9456
Comments
I have the same problem. The bug seems to have been introduced since the version 2.6.0. |
It seems to be caused by Terser. You can workaround this as follows for now: const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
entry: './src/js/vue-first.js',
output: {
filename: 'todo.js',
path: path.resolve(__dirname, 'dist')
},
optimization: {
minimizer: [
new TerserPlugin({
cache: true,
parallel: true,
sourceMap: true,
terserOptions: {
output: {
ascii_only: true // <- Add this to keep the regex valid
}
}
}),
],
}
}; |
I'm taking a look at this |
I couldn't spend more time on this for now but it's weird since using raw terser with the regex at https://github.com/vuejs/vue/blob/dev/src/core/util/lang.js#L8, and more specifically |
/cc @sodatea not sure if this is affecting the CLI which also uses Terser. Maybe it has to do with a specific version of Terser? |
It works with http, but not |
Or with |
So, as I tested out on https://xem.github.io/terser-online/, unicode sequences in strings (e.g. |
this may be node version, just me try run build or run dev in localhost, is ok, however,when i build it in server, just throw npm audit fix, Invalid regular expression ... so upgrade node --version ,is build success |
Version
2.6.3
Reproduction link
https://github.com/inherithandle/vue-webpack-simple-project
Steps to reproduce
What is expected?
I expected index.html to be rendered successfully.
What is actually happening?
I get the error: "SyntaxError: invalid range in character class"
I think it is similar to the issue #2291.
The text was updated successfully, but these errors were encountered: