mirror of
https://github.com/zhigang1992/Recoil.git
synced 2026-04-29 04:45:27 +08:00
babel plugins consistency (#200)
Summary: Fix what is broken and blocking a new release. - Fix missing plugin in `.babelrc` - Sort and ensure that babel plugins are same in both .babelrc and rollup - Add `preset-fbjs/plugins/dev-expression` to strip `__DEV__` code from prod bundle and remove env checks in dev. We use this on TSDX to shave bytes https://github.com/jaredpalmer/tsdx#advanced-babel-plugin-dev-expressions The tests are failing legitimately AFAICT. Wondering if this is because it uses an either some kind of special fbjs setup environment, or perhaps the www build of react? I tried against react@experimental and still failing. I'm pretty sure it's not a jest or babel issue at the moment. However, these changes allow for a new 0.0.8 release, fixing tests can come later. Closes https://github.com/facebookexperimental/Recoil/issues/198 #197 https://github.com/facebookexperimental/Recoil/issues/107 #33 Pull Request resolved: https://github.com/facebookexperimental/Recoil/pull/200 Reviewed By: drarmstr Differential Revision: D21795000 Pulled By: mondaychen fbshipit-source-id: 7360a8478c2c72f7acb31c27b2e27e467d7f1555
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2ed203ff82
commit
cf763ef23b
4
.babelrc
4
.babelrc
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"presets": ["@babel/react"],
|
||||
"presets": ["@babel/react", "@babel/flow"],
|
||||
"plugins": [
|
||||
[
|
||||
"module-resolver",
|
||||
@@ -12,6 +12,8 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"babel-preset-fbjs/plugins/dev-expression",
|
||||
"@babel/plugin-proposal-class-properties",
|
||||
"@babel/proposal-nullish-coalescing-operator",
|
||||
"@babel/proposal-optional-chaining",
|
||||
"@babel/transform-flow-strip-types"
|
||||
|
||||
@@ -16,9 +16,11 @@ const config = mode => ({
|
||||
babel({
|
||||
presets: ['@babel/preset-react', '@babel/preset-flow'],
|
||||
plugins: [
|
||||
'babel-preset-fbjs/plugins/dev-expression',
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
'@babel/plugin-proposal-nullish-coalescing-operator',
|
||||
'@babel/plugin-proposal-optional-chaining',
|
||||
'@babel/plugin-proposal-class-properties',
|
||||
'@babel/transform-flow-strip-types',
|
||||
],
|
||||
babelHelpers: 'bundled',
|
||||
}),
|
||||
@@ -35,7 +37,9 @@ const config = mode => ({
|
||||
},
|
||||
nodeResolve(),
|
||||
commonjs(),
|
||||
replace({__DEV__: JSON.stringify(mode === 'development')}),
|
||||
replace({
|
||||
'process.env.NODE_ENV': JSON.stringify(mode),
|
||||
}),
|
||||
mode === 'development' ? undefined : terser({mangle: false}),
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user