I used the Vue cli to create this application. babel.config.js was already in the directory that the cli automatically created but I added the vue.config.js file. What is the difference between these 2 files and can i combine them? it is confusing because they both end with "config.js" so i am thinking that they might have something in common.
This is my babel.config.js
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
This is my vue.config.js
module.exports = {
devServer: {
proxy: {
'^/users': {
target: 'http://localhost:5000',
ws: true,
changeOrigin: true
},
'^/api': {
target: 'http://localhost:5000',
ws: true,
changeOrigin: true
}
}
}
};
babel.config.js
configures Babel. vue.config.js
configures Vue.
These are two different things. Babel transforms newer Javascript into old Javascript so that older browsers (notably IE11) can understand it. Vue uses Javascript to render DOM nodes. They work together to make it easy to run a javascript application.
You can configure both packages in package.json, as @skirtle pointed out in the comments, or you can leave them separate so you don't confuse the different configurations. Same goes for other packages' config files you may encounter in the future like postcss.config.js
, eslint.config.js
, tailwind.config.js
etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With