1 | # @babel/preset-stage-0
|
2 |
|
3 | As of v7.0.0-beta.55, we've removed Babel's Stage presets. Please consider reading our [blog post](https://babeljs.io/blog/2018/07/27/removing-babels-stage-presets) on this decision for more details. TL;DR is that it's more beneficial in the long run to explicitly add which proposals to use.
|
4 |
|
5 | ---
|
6 |
|
7 | For a more automatic migration, we have updated [babel-upgrade](https://github.com/babel/babel-upgrade) to do this for you (you can run `npx babel-upgrade`).
|
8 |
|
9 | If you want the same configuration as before:
|
10 |
|
11 | ```jsonc
|
12 | {
|
13 | "plugins": [
|
14 | // Stage 0
|
15 | "@babel/plugin-proposal-function-bind",
|
16 |
|
17 | // Stage 1
|
18 | "@babel/plugin-proposal-export-default-from",
|
19 | "@babel/plugin-proposal-logical-assignment-operators",
|
20 | ["@babel/plugin-proposal-optional-chaining", { "loose": false }],
|
21 | ["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }],
|
22 | ["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }],
|
23 | "@babel/plugin-proposal-do-expressions",
|
24 |
|
25 | // Stage 2
|
26 | ["@babel/plugin-proposal-decorators", { "legacy": true }],
|
27 | "@babel/plugin-proposal-function-sent",
|
28 | "@babel/plugin-proposal-export-namespace-from",
|
29 | "@babel/plugin-proposal-numeric-separator",
|
30 | "@babel/plugin-proposal-throw-expressions",
|
31 |
|
32 | // Stage 3
|
33 | "@babel/plugin-syntax-dynamic-import",
|
34 | "@babel/plugin-syntax-import-meta",
|
35 | ["@babel/plugin-proposal-class-properties", { "loose": true }],
|
36 | "@babel/plugin-proposal-json-strings"
|
37 | ]
|
38 | }
|
39 | ```
|
40 |
|
41 | If you're using the same configuration across many separate projects,
|
42 | keep in mind that you can also create your own custom presets with
|
43 | whichever plugins and presets you're looking to use.
|
44 |
|
45 | ```js
|
46 | module.exports = function() {
|
47 | return {
|
48 | plugins: [
|
49 | require("@babel/plugin-syntax-dynamic-import"),
|
50 | [require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
51 | [require("@babel/plugin-proposal-class-properties"), { "loose": true }],
|
52 | ],
|
53 | presets: [
|
54 | // ...
|
55 | ],
|
56 | };
|
57 | };
|
58 | ```
|
59 |
|
60 | **NOTE: Compatibility between `@babel/plugin-proposal-class-properties` and `@babel/plugin-proposal-decorators`**
|
61 | If you are including your plugins manually and using `@babel/plugin-proposal-class-properties`, make sure that `@babel/plugin-proposal-decorators` comes before `@babel/plugin-proposal-class-properties`.
|
62 |
|
63 | When using the `legacy: true` option of `@babel/plugin-proposal-decorators`, `@babel/plugin-proposal-class-properties` must be used in `loose: true` mode.
|
64 |
|
65 | If you are not using `@babel/plugin-proposal-decorators`, `loose` mode is not needed. |
\ | No newline at end of file |