Error description
An Unexpected token error occurred when packaging and compiling the vue cli project.
The error is ??
syntax.
try solution
Is it a compile error for ts?
https://stackoverflow.com/questions/58813176/webpack-cant-compile-ts-3-7-optional-chaining-nullish-coalescing
Whether the preset
https://github.com/vuejs/vue-cli/pull/6459/files is not triggered
"browserslist": [
"samsung 12.0"
],
works for me
// babel.config.js
module.exports = {
presets: [
[
'@vue/app',
{
polyfills: ['es.promise', 'es.symbol']
}
]
],
plugins: [
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
],
}
Add two plugins to babel