ERROR in static20230207/js/message.js from UglifyJs
SyntaxError: Unexpected token: name (Vue) [./src/module/message/message.js:1,7]
I have a vue 1 project. I meet the above error as running npm run build
. My current node-sass version is ^4.12.0 and node.js version is 18.15.0.
I have searched many information on web and try to resolve it. I created the .babelrc file and this was the content.
{
"presets": [
["env", {
"modules": false ,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-runtime"],
"comments": false,
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["istanbul"]
}
}
}
I also added some configuration in the module node of webpack.base.conf.js
.
rules: [
{ test :/\.js$/, use :'babel-loader', exclude:/node_modules/ }
]
But it isn't work. There are the same errors when I build the project. Please someone help me!
Top comments (3)
I has similar problems pulling down a Vue2 app to a new machine. Eventually set up a new Vue 3 app and migrated everything across. It took time and was painful
Delete all the node packages and reinstall.
Remove all your components, router and sass files and go back to a base Hello Word app
If this works start adding things back in. If not, create a new project and start copying stuff across until it breaks
Thank you so much! I'll try it. If it doesn't work, I would create a new Vue 3 app. After all, I only want to use a couple of views in it. The current app based on Vue 1 is too old and its developer is a previous engineer.
I would definately be moving that over to Vue 3. Probably less effort overall if the app is of any size.