vue-cli icon indicating copy to clipboard operation
vue-cli copied to clipboard

Should Babel transpile node_modules folder by default?

Open Mikilll94 opened this issue 4 years ago • 2 comments

What problem does this feature solve?

Babel-loader recommends not transpiling node_modules folder, because it slows down compilation process. https://github.com/babel/babel-loader#babel-loader-is-slow

However, I see that vue-cli transpiles node_modules folder. Only core-js and @babel/runtime are not getting transpiled.

https://github.com/vuejs/vue-cli/blob/4ce7edd3754c3856c760d126f7fa3928f120aa2e/packages/%40vue/babel-preset-app/index.js#L262

Maybe this default behavior should be changed?

What does the proposed API look like?

Do not transpile node_modules folder by default.

Mikilll94 avatar Feb 16 '21 23:02 Mikilll94

Just for anyone coming here, node_modules is not transpiled by default, but it can be configured in https://cli.vuejs.org/config/#transpiledependencies

// vue.config.js
transpileDependencies: ['my-dependency-goes-here'],

tfoxkiu avatar Feb 05 '24 16:02 tfoxkiu

@tfoxkiu Which compiler does it use behind the scenes to compile packages?

nyngwang avatar Feb 06 '24 08:02 nyngwang