admin管理员组文章数量:1279019
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 bine them? it is confusing because they both end with "config.js" so i am thinking that they might have something in mon.
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
}
}
}
};
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 bine them? it is confusing because they both end with "config.js" so i am thinking that they might have something in mon.
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
}
}
}
};
Share
Improve this question
asked May 8, 2020 at 7:49
YoIts LemonBoyYoIts LemonBoy
1051 silver badge4 bronze badges
1
-
Both of these files can be merged into
package.json
if you prefer. See cli.vuejs/config/#vue-config-js and babeljs.io/docs/en/config-files – skirtle Commented May 8, 2020 at 11:02
1 Answer
Reset to default 11babel.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 ments, 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.
本文标签:
版权声明:本文标题:javascript - what is the difference between babel.config.js and vue.config.js and can i combine the 2 files? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741213187a2359533.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论