|
2 | 2 |
|
3 | 3 | This is the default Babel preset used in all Vue CLI projects. **Note: this preset is meant to be used exclusively in projects created via Vue CLI and does not consider external use cases.**
|
4 | 4 |
|
5 |
| -## Included |
6 |
| - |
7 |
| -- [@babel/preset-env](https://new.babeljs.io/docs/en/next/babel-preset-env.html) |
8 |
| - - `modules: false` |
9 |
| - - auto set to `'commonjs'` in Jest tests |
10 |
| - - [`useBuiltIns: 'usage'`](#usebuiltins) |
11 |
| - - `targets` is determined: |
12 |
| - - using `browserslist` field in `package.json` when building for browsers |
13 |
| - - set to `{ node: 'current' }` when running unit tests in Node.js |
| 5 | +## Included Features |
| 6 | + |
| 7 | +### [@babel/preset-env](https://new.babeljs.io/docs/en/next/babel-preset-env.html) |
| 8 | + |
| 9 | +`preset-env` automatically determines the transforms and polyfills to apply based on your browser target. See [Browser Compatibility](https://cli.vuejs.org/guide/browser-compatibility.html) section in docs for more details. |
| 10 | + |
| 11 | +- `modules: false` |
| 12 | + - auto set to `'commonjs'` in Jest tests |
| 13 | +- [`useBuiltIns: 'usage'`](#usebuiltins) |
| 14 | +- `targets` is determined: |
| 15 | + - using `browserslist` field in `package.json` when building for browsers |
| 16 | + - set to `{ node: 'current' }` when running unit tests in Node.js |
14 | 17 | - Includes `Promise` polyfill by default so that they are usable even in non-transpiled dependencies (only for environments that need it)
|
15 |
| -- [@babel/plugin-transform-runtime](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime) |
16 |
| - - Only enabled for helpers since polyfills are handled by `babel-preset-env` |
17 |
| -- [dynamic import syntax](https://github.com/tc39/proposal-dynamic-import) |
18 |
| -- [Object rest spread](https://github.com/tc39/proposal-object-rest-spread) |
19 |
| -- [babel-preset-stage-2](https://github.com/babel/babel/tree/master/packages/babel-preset-stage-2) |
20 |
| -- Vue JSX support |
21 |
| - - [@babel/plugin-syntax-jsx](https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-jsx) |
22 |
| - - [babel-plugin-transform-vue-jsx](https://github.com/vuejs/babel-plugin-transform-vue-jsx) |
23 |
| - - ~~[babel-plugin-jsx-event-modifiers](https://github.com/nickmessing/babel-plugin-jsx-event-modifiers)~~ (temporarily disabled until fixed for Babel 7) |
24 |
| - - ~~[babel-plugin-jsx-v-model](https://github.com/nickmessing/babel-plugin-jsx-v-model)~~ (temporarily disabled until fixed for Babel 7) |
| 18 | + |
| 19 | +### Stage 3 or Below |
| 20 | + |
| 21 | +Only the following stage 3 or below features are supported (object reset spread is supported as part of `preset-env`): |
| 22 | + |
| 23 | +- [Dynamic Import Syntax](https://github.com/tc39/proposal-dynamic-import) |
| 24 | +- [Proposal Class Properties](https://babeljs.io/docs/en/next/babel-plugin-proposal-class-properties.html) |
| 25 | +- [Proposal Decorators (legacy)](https://babeljs.io/docs/en/next/babel-plugin-proposal-decorators.html) |
| 26 | + |
| 27 | +If you need additional stage 3 or below features, you need to install and configure it yourself. |
| 28 | + |
| 29 | +### Vue JSX support |
| 30 | + |
| 31 | +- [@babel/plugin-syntax-jsx](https://github.com/babel/babel/tree/master/packages/babel-plugin-syntax-jsx) |
| 32 | +- [babel-plugin-transform-vue-jsx](https://github.com/vuejs/babel-plugin-transform-vue-jsx) |
| 33 | +- ~~[babel-plugin-jsx-event-modifiers](https://github.com/nickmessing/babel-plugin-jsx-event-modifiers)~~ (temporarily disabled until fixed for Babel 7) |
| 34 | +- ~~[babel-plugin-jsx-v-model](https://github.com/nickmessing/babel-plugin-jsx-v-model)~~ (temporarily disabled until fixed for Babel 7) |
| 35 | + |
| 36 | +### [@babel/plugin-transform-runtime](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime) |
| 37 | + |
| 38 | +`transform-runtime` avoids inlining helpers in every file. This is enabled for helpers only, since polyfills are handled by `babel-preset-env`. |
25 | 39 |
|
26 | 40 | ## Options
|
27 | 41 |
|
|
0 commit comments