GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Fresh] Add skipEnvCheck option to Babel plugin (#16688) · react/react@b260bef

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-refresh/src
    • ReactFreshBabelPlugin.js
    • __tests__
      • ReactFreshBabelPlugin-test.js
      • ReactFreshIntegration-test.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-refresh/src/ReactFreshBabelPlugin.js‎

Copy file name to clipboardExpand all lines: packages/react-refresh/src/ReactFreshBabelPlugin.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
'use strict';
99

10-
export default function(babel) {
10+
export default function(babel, opts) {
1111
if (typeof babel.getEnv === 'function') {
1212
// Only available in Babel 7.
1313
const env = babel.getEnv();
14-
if (env !== 'development' && typeof expect !== 'function') {
14+
if (env !== 'development' && !opts.skipEnvCheck) {
1515
throw new Error(
1616
'React Refresh Babel transform should only be enabled in development environment. ' +
1717
'Instead, the environment is: "' +
1818
env +
19-
'".',
19+
'". If you want to override this check, pass {skipEnvCheck: true} as plugin options.',
2020
);
2121
}
2222
}
Collapse file

‎packages/react-refresh/src/__tests__/ReactFreshBabelPlugin-test.js‎

Copy file name to clipboardExpand all lines: packages/react-refresh/src/__tests__/ReactFreshBabelPlugin-test.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function transform(input, options = {}) {
1919
plugins: [
2020
'@babel/syntax-jsx',
2121
'@babel/syntax-dynamic-import',
22-
freshPlugin,
22+
[freshPlugin, {skipEnvCheck: true}],
2323
...(options.plugins || []),
2424
],
2525
}).code,
Collapse file

‎packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js‎

Copy file name to clipboardExpand all lines: packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('ReactFreshIntegration', () => {
6060
babelrc: false,
6161
presets: ['@babel/react'],
6262
plugins: [
63-
freshPlugin,
63+
[freshPlugin, {skipEnvCheck: true}],
6464
'@babel/plugin-transform-modules-commonjs',
6565
compileDestructuring && '@babel/plugin-transform-destructuring',
6666
].filter(Boolean),

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.