Make WordPress Core

Changeset 58775


Ignore:
Timestamp:
07/22/2024 10:00:09 AM (7 months ago)
Author:
youknowriad
Message:

Build Tools: Use umd builds provided by React instead of bundling our own builds.

We tried moving away from the deprecated React UMD builds previously,
the problem we faced is that there's a warning that is triggered on the console because we're not using a separate impact for createRoot.

This warning has been removed in React 19 along with the removal of the UMD builds, so we should be able to revert this commit when we upgrade to React 19 but for now, we need to restore the usage of the umd builds.

Props mamaduka.
See #61324.

Location:
trunk/tools/webpack
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/webpack/packages.js

    r58271 r58775  
    9797        'moment.js': 'moment/moment.js',
    9898        'regenerator-runtime.js': 'regenerator-runtime/runtime.js',
     99        'react.js': 'react/umd/react.development.js',
     100        'react-dom.js': 'react-dom/umd/react-dom.development.js',
    99101    };
    100102
     
    110112        'wp-polyfill-inert.min.js': 'wicg-inert/dist/inert.min.js',
    111113        'moment.min.js': 'moment/min/moment.min.js',
     114        'react.min.js': 'react/umd/react.production.min.js',
     115        'react-dom.min.js': 'react-dom/umd/react-dom.production.min.js',
    112116    };
    113117
  • trunk/tools/webpack/vendors.js

    r58273 r58775  
    55
    66const importedVendors = {
    7     react: { import: 'react', global: 'React' },
    8     'react-dom': { import: 'react-dom', global: 'ReactDOM' },
    97    'react-jsx-runtime': {
    108        import: 'react/jsx-runtime',
     
    2220        ? 'build'
    2321        : 'src';
    24     buildTarget = buildTarget + '/wp-includes/js/dist/vendor/';
     22    buildTarget = buildTarget + '/wp-includes/js/dist/vendor/';
    2523    return [
    2624        ...Object.entries( importedVendors ).flatMap( ( [ name, config ] ) => {
     
    4644                    },
    4745
    48                     externals:
    49                         name === 'react'
    50                             ? {}
    51                             : {
    52                                     react: 'React',
    53                               },
     46                    externals: {
     47                        react: 'React',
     48                    },
    5449                };
    5550            } );
Note: See TracChangeset for help on using the changeset viewer.