Skip to content

[Bug]: After upgrading to babel-plugin-transform-react-constant-elements v7.17.6 our application has stopped working correctly #14363

@budarin

Description

@budarin

💻

  • Would you like to work on a fix?

How are you using Babel?

babel-loader (webpack)

Input code

It is difficult to cite the code of the entire application and it is unclear at what point the failure occurs

Configuration file name

babel.config.js

Configuration

const coreJsVer = require('./coreJsVer');
const isTesting = process.env.NODE_ENV === 'test';
const isDev = process.env.NODE_ENV !== 'production';

module.exports = function (api) {
    api.cache.using(() => process.env.NODE_ENV);

    return {
        comments: true,
        presets: [
            [
                '@babel/preset-env',
                {
                    loose: true,
                    debug: false,
                    modules: isTesting ? 'commonjs' : false,
                    corejs: {
                        version: coreJsVer,
                        proposals: true,
                    },
                    useBuiltIns: 'usage',
                    bugfixes: true,
                },
            ],
            [
                '@babel/preset-react',
                {
                    useBuiltIns: true,
                    runtime: 'automatic',
                    development: isDev,
                },
            ],
            '@babel/typescript',
        ],
        plugins: ['./lazyComponentBabelPlugin.js', 'preval'],
        env: {
            production: {
                plugins: [
                    'babel-plugin-transform-imports',
                    'babel-plugin-react-local',
                    // '@babel/plugin-transform-react-constant-elements',
                ],
                ignore: ['**/*.test.tsx', '**/*.test.ts', '__snapshots__', '__tests__'],
            },
            development: {
                plugins: [],
                ignore: ['**/*.test.tsx', '**/*.test.ts', '__snapshots__', '__tests__'],
            },
            test: {
                ignore: ['__snapshots__'],
            },
        },
    };
};

Current and expected behavior

After updating the plugin, navigation in the application with react-router with code splitting stopped working

If you disable the plugin, everything works fine

Environment

  • "@babel/core": "^7.17.7"
  • Node v16.9.0
  • Yarn 1.22.15
  • OS: any
  • Monorepo: no

Possible solution

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

area: reacti: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions