8000 docs: moved Babel plugin doc · NataliaTepluhina/vue-cli@c098201 · GitHub
[go: up one dir, main page]

Skip to content

Commit c098201

Browse files
docs: moved Babel plugin doc
1 parent 8d16caa commit c098201

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

docs/.vuepress/config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ module.exports = {
140140
}
141141
],
142142
'/core-plugins/': [
143-
'/core-plugins/pwa.md'
143+
'/core-plugins/pwa.md',
144+
'/core-plugins/babel.md'
144145
]
145146
}
146147
},

docs/core-plugins/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Vue CLI uses a plugin-based architecture. If you inspect a newly created project
44

55
This section contains documentation for core Vue CLI plugins:
66

7-
- Babel
7+
- [Babel](babel.md)
88
- TypeScript
99
- ESLint
1010
- [PWA](pwa.md)

docs/core-plugins/babel.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# @vue/cli-plugin-babel
2+
3+
> Babel plugin for Vue CLI
4+
5+
## Configuration
6+
7+
Uses Babel 7 + `babel-loader` + [@vue/babel-preset-app](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app) by default, but can be configured via `babel.config.js` to use any other Babel presets or plugins.
8+
9+
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`:
10+
11+
``` js
12+
module.exports = {
13+
transpileDependencies: [
14+
// can be string or regex
15+
'my-dep',
16+
/other-dep/
17+
]
18+
}
19+
```
20+
21+
## Caching
22+
23+
[cache-loader](https://github.com/webpack-contrib/cache-loader) is enabled by default and cache is stored in `<projectRoot>/node_modules/.cache/babel-loader`.
24+
25+
## Parallelization
26+
27+
[thread-loader](https://github.com/webpack-contrib/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`.
28+
29+
## Installing in an Already Created Project
30+
31+
``` sh
32+
vue add @vue/babel
33+
```
34+
35+
## Injected webpack-chain Rules
36+
37+
- `config.rule('js')`
38+
- `config.rule('js').use('babel-loader')`
39+
- `config.rule('js').use('cache-loader')`

0 commit comments

Comments
 (0)
0