wordpress/webpack.config.js
Greg Ziółkowski 0b8b80449f Build: Prepare for more Script Modules
This is a companion to https://github.com/WordPress/gutenberg/pull/65460 that requires syncing in WordPress Core. Namely, the block-library changes require registration with their updated script module IDs so that the blocks continue to work correctly.

They key improvement is script modules registration is handled in one central place, and a combined asset file is used to improve the performance by avoiding multiple disk operations for every individual file.

Props jonsurrell, gziolo, wildworks, noisysocks.
See #60647, #59462.



git-svn-id: https://develop.svn.wordpress.org/trunk@59083 602fd350-edb4-49c9-b593-d223f7449a82
2024-09-24 07:33:55 +00:00

28 lines
829 B
JavaScript

const blocksConfig = require( './tools/webpack/blocks' );
const developmentConfig = require( './tools/webpack/development' );
const mediaConfig = require( './tools/webpack/media' );
const packagesConfig = require( './tools/webpack/packages' );
const scriptModulesConfig = require( './tools/webpack/script-modules' );
const vendorsConfig = require( './tools/webpack/vendors' );
module.exports = function( env = { environment: "production", watch: false, buildTarget: false } ) {
if ( ! env.watch ) {
env.watch = false;
}
if ( ! env.buildTarget ) {
env.buildTarget = ( env.mode === 'production' ? 'build/' : 'src/' );
}
const config = [
blocksConfig( env ),
...developmentConfig( env ),
mediaConfig( env ),
packagesConfig( env ),
scriptModulesConfig( env ),
...vendorsConfig( env ),
];
return config;
};