Skip to content

Commit

Permalink
Cleanup Babel PR (ReactFreshPlugin) (#16340)
Browse files Browse the repository at this point in the history
* fix babel 7 issues

* fix babel 7 issues
  • Loading branch information
lunaruan authored and gaearon committed Aug 13, 2019
1 parent dc31608 commit 89bbffe
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 68 deletions.
2 changes: 1 addition & 1 deletion packages/react-refresh/src/ReactFreshBabelPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function(babel) {
if (typeof babel.getEnv === 'function') {
// Only available in Babel 7.
const env = babel.getEnv();
if (env !== 'development') {
if (env !== 'development' && typeof expect !== 'function') {
throw new Error(
'React Refresh Babel transform should only be enabled in development environment. ' +
'Instead, the environment is: "' +
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/jest/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ module.exports = {
modulePathIgnorePatterns: [
'<rootDir>/scripts/rollup/shims/',
'<rootDir>/scripts/bench/',
// ReactFreshBabelPlugin is only available for dev.
// We need two tests here because otherwise, ReactFreshBabelPlugin-test will
// fail due to obsolete snapshots
process.env.NODE_ENV === 'development'
? '<rootDir>/packages/react-refresh/src/__tests__/ReactFreshBabelPluginProd-test.js'
: '<rootDir>/packages/react-refresh/src/__tests__/ReactFreshBabelPlugin-test.js',
],
transform: {
'.*': require.resolve('./preprocessor.js'),
Expand Down
6 changes: 0 additions & 6 deletions scripts/jest/config.source-persistent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ module.exports = Object.assign({}, baseConfig, {
'ReactIncrementalTriangle',
'ReactIncrementalReflection',
'forwardRef',
// ReactFreshBabelPlugin is only available for dev.
// We need two tests here because otherwise, ReactFreshBabelPlugin-test will
// fail due to obsolete snapshots
process.env.NODE_ENV === 'development'
? '<rootDir>/packages/react-refresh/src/__tests__/ReactFreshBabelPluginProd-test.js'
: '<rootDir>/packages/react-refresh/src/__tests__/ReactFreshBabelPlugin-test.js',
],
setupFiles: [
...baseConfig.setupFiles,
Expand Down
9 changes: 0 additions & 9 deletions scripts/rollup/bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ const bundles = [
externals: ['react'],
babel: opts =>
Object.assign({}, opts, {
// Include JSX
plugins: opts.plugins.concat([
[require.resolve('@babel/plugin-transform-classes'), {loose: true}],
]),
Expand All @@ -149,7 +148,6 @@ const bundles = [
externals: ['react', 'stream'],
babel: opts =>
Object.assign({}, opts, {
// Include JSX
plugins: opts.plugins.concat([
[require.resolve('@babel/plugin-transform-classes'), {loose: true}],
]),
Expand Down Expand Up @@ -208,7 +206,6 @@ const bundles = [
externals: ['react-native'],
babel: opts =>
Object.assign({}, opts, {
// Include JSX
plugins: opts.plugins.concat([
[require.resolve('@babel/plugin-transform-classes'), {loose: true}],
]),
Expand All @@ -222,7 +219,6 @@ const bundles = [
externals: ['react-native'],
babel: opts =>
Object.assign({}, opts, {
// Include JSX
plugins: opts.plugins.concat([
[require.resolve('@babel/plugin-transform-classes'), {loose: true}],
]),
Expand All @@ -238,7 +234,6 @@ const bundles = [
externals: ['react-native'],
babel: opts =>
Object.assign({}, opts, {
// Include JSX
plugins: opts.plugins.concat([
[require.resolve('@babel/plugin-transform-classes'), {loose: true}],
]),
Expand All @@ -252,7 +247,6 @@ const bundles = [
externals: ['react-native'],
babel: opts =>
Object.assign({}, opts, {
// Include JSX
plugins: opts.plugins.concat([
[require.resolve('@babel/plugin-transform-classes'), {loose: true}],
]),
Expand All @@ -268,7 +262,6 @@ const bundles = [
externals: ['react', 'scheduler', 'scheduler/unstable_mock'],
babel: opts =>
Object.assign({}, opts, {
// Include JSX
plugins: opts.plugins.concat([
[require.resolve('@babel/plugin-transform-classes'), {loose: true}],
]),
Expand All @@ -282,7 +275,6 @@ const bundles = [
externals: ['react', 'scheduler', 'scheduler/unstable_mock'],
babel: opts =>
Object.assign({}, opts, {
// Include JSX
plugins: opts.plugins.concat([
[require.resolve('@babel/plugin-transform-classes'), {loose: true}],
]),
Expand Down Expand Up @@ -402,7 +394,6 @@ const bundles = [
externals: ['react'],
babel: opts =>
Object.assign({}, opts, {
// Include JSX
plugins: opts.plugins.concat([
[require.resolve('@babel/plugin-transform-classes'), {loose: true}],
]),
Expand Down

0 comments on commit 89bbffe

Please sign in to comment.