babel-preset-react-app 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/create.js +16 -0
  2. package/package.json +2 -1
package/create.js CHANGED
@@ -117,6 +117,11 @@ module.exports = function(api, opts, env) {
117
117
  // in practice some other transforms (such as object-rest-spread)
118
118
  // don't work without it: https://github.com/babel/babel/issues/7215
119
119
  require('@babel/plugin-transform-destructuring').default,
120
+ // Turn on legacy decorators for TypeScript files
121
+ isTypeScriptEnabled && [
122
+ require('@babel/plugin-proposal-decorators').default,
123
+ false,
124
+ ],
120
125
  // class { handleClick = () => { } }
121
126
  // Enable loose mode to use assignment instead of defineProperty
122
127
  // See discussion in https://github.com/facebook/create-react-app/issues/4263
@@ -166,5 +171,16 @@ module.exports = function(api, opts, env) {
166
171
  // Transform dynamic import to require
167
172
  require('babel-plugin-dynamic-import-node'),
168
173
  ].filter(Boolean),
174
+ overrides: [
175
+ isTypeScriptEnabled && {
176
+ test: /\.tsx?$/,
177
+ plugins: [
178
+ [
179
+ require('@babel/plugin-proposal-decorators').default,
180
+ { legacy: true },
181
+ ],
182
+ ],
183
+ },
184
+ ].filter(Boolean),
169
185
  };
170
186
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babel-preset-react-app",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Babel preset used by Create React App",
5
5
  "repository": "facebook/create-react-app",
6
6
  "license": "MIT",
@@ -19,6 +19,7 @@
19
19
  "dependencies": {
20
20
  "@babel/core": "7.1.0",
21
21
  "@babel/plugin-proposal-class-properties": "7.1.0",
22
+ "@babel/plugin-proposal-decorators": "7.1.2",
22
23
  "@babel/plugin-proposal-object-rest-spread": "7.0.0",
23
24
  "@babel/plugin-syntax-dynamic-import": "7.0.0",
24
25
  "@babel/plugin-transform-classes": "7.1.0",