Files
vue-cli/packages/@vue/cli-plugin-babel
Haoqun Jiang c8cecffedb refactor: remove usage of deprecated babel functions, preparing for babel 8 (#5133)
* refactor: use babel.loadPartialConfigSync (added in babel 7.8)

As planned in https://github.com/babel/babel/issues/10746,
in babel 8 the old `loadPartialConfig` can't be used synchronously.

* refactor: remove dependence on internal babel files, preparing for babel 8

See
https://github.com/babel/babel/issues/10746
https://github.com/babel/babel/pull/10899
2020-02-03 19:52:42 +08:00
..
2020-02-02 23:08:35 +08:00
2020-02-02 23:08:35 +08:00
2018-03-20 01:39:26 +01:00
2020-02-02 23:08:35 +08:00

@vue/cli-plugin-babel

babel plugin for vue-cli

Configuration

Uses Babel 7 + babel-loader + @vue/babel-preset-app by default, but can be configured via babel.config.js to use any other Babel presets or plugins.

By default, babel-loader excludes files inside node_modules dependencies. If you wish to explicitly transpile a dependency module, you will need to add it to the transpileDependencies option in vue.config.js:

module.exports = {
  transpileDependencies: [
    // can be string or regex
    'my-dep',
    /other-dep/
  ]
}

Caching

cache-loader is enabled by default and cache is stored in <projectRoot>/node_modules/.cache/babel-loader.

Parallelization

thread-loader is enabled by default when the machine has more than 1 CPU cores. This can be turned off by setting parallel: false in vue.config.js.

Installing in an Already Created Project

vue add babel

Injected webpack-chain Rules

  • config.rule('js')
  • config.rule('js').use('babel-loader')
  • config.rule('js').use('cache-loader')