diff --git a/packages/wp-build/CHANGELOG.md b/packages/wp-build/CHANGELOG.md index 8a8f3f6eb44b8f..b2cc4f583a1e20 100644 --- a/packages/wp-build/CHANGELOG.md +++ b/packages/wp-build/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Breaking Changes + +- `@wordpress/boot`, `@wordpress/route`, `@wordpress/theme`, and `@wordpress/private-apis` are no longer bundled. They are now expected to be provided by WordPress Core (7.0+) or the Gutenberg plugin. + ### Enhancements - Avoid unexpected results when typecasting `IS_GUTENBERG_PLUGIN` and `IS_WORDPRESS_CORE` values to Booleans ([#75844](https://github.com/WordPress/gutenberg/pull/75844)). diff --git a/packages/wp-build/lib/build.mjs b/packages/wp-build/lib/build.mjs index c5ad3cbea9038b..9de4efadfe0469 100755 --- a/packages/wp-build/lib/build.mjs +++ b/packages/wp-build/lib/build.mjs @@ -1821,51 +1821,6 @@ async function buildAll( baseUrlExpression ) { }; } ); - // Bundle boot, route, and theme packages from node_modules when pages exist - if ( pageData.length > 0 ) { - try { - const { createRequire } = await import( 'module' ); - const require = createRequire( import.meta.url ); - - // Resolve the @wordpress packages directory from node_modules - const bootPackageJson = require.resolve( - '@wordpress/boot/package.json', - { paths: [ ROOT_DIR ] } - ); - const wordpressPackagesDir = path.dirname( - path.dirname( bootPackageJson ) - ); - - // Bundle boot, route, theme, and private-apis packages - const externalPackages = [ - 'boot', - 'route', - 'theme', - 'private-apis', - ]; - for ( const pkgName of externalPackages ) { - const result = await bundlePackage( pkgName, { - sourceDir: wordpressPackagesDir, - handlePrefix: 'wp', - scriptGlobal: 'wp', - packageNamespace: 'wordpress', - } ); - - if ( result && result.modules ) { - modules.push( ...result.modules ); - } - if ( result && result.scripts ) { - scripts.push( ...result.scripts ); - } - } - } catch ( error ) { - console.warn( - '\n⚠️ Warning: Could not bundle WordPress packages for pages:', - error.message - ); - } - } - console.log( '\n📄 Generating PHP registration files...\n' ); const phpReplacements = await getPhpReplacements( ROOT_DIR,