Skip to content

Commit

Permalink
chore(webpack): remove DISABLE_NEW_JSX_TRANSFORM option
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoMcA committed May 14, 2024
1 parent 4249546 commit c838dab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 33 deletions.
15 changes: 1 addition & 14 deletions client/config/jest/babelTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,12 @@ import babelJest from "babel-jest";

const require = createRequire(import.meta.url);

const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === "true") {
return false;
}

try {
require.resolve("react/jsx-runtime");
return true;
} catch (e) {
return false;
}
})();

export default babelJest.createTransformer({
presets: [
[
require.resolve("babel-preset-react-app"),
{
runtime: hasJsxRuntime ? "automatic" : "classic",
runtime: "automatic",
},
],
],
Expand Down
20 changes: 1 addition & 19 deletions client/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@ const babelRuntimeRegenerator = resolve.sync("@babel/runtime/regenerator", {
const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === "true";
const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === "true";

const hasJsxRuntime = (() => {
if (process.env.DISABLE_NEW_JSX_TRANSFORM === "true") {
return false;
}

try {
resolve.sync("react/jsx-runtime");
return true;
} catch (e) {
return false;
}
})();

// This is the production and development configuration.
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
function config(webpackEnv) {
Expand Down Expand Up @@ -339,7 +326,7 @@ function config(webpackEnv) {
[
resolve.sync("babel-preset-react-app"),
{
runtime: hasJsxRuntime ? "automatic" : "classic",
runtime: "automatic",
},
],
],
Expand Down Expand Up @@ -589,11 +576,6 @@ function config(webpackEnv) {
),
baseConfig: {
extends: [resolve.sync("eslint-config-react-app/base")],
rules: {
...(!hasJsxRuntime && {
"react/react-in-jsx-scope": "error",
}),
},
},
}),
].filter(Boolean),
Expand Down

0 comments on commit c838dab

Please sign in to comment.