Skip to content

Commit

Permalink
Build: Stop generating unused legacy scripts for core blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Dec 2, 2024
1 parent b867a5f commit 4e736dd
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions tools/webpack/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,18 @@
*/
const CopyWebpackPlugin = require( 'copy-webpack-plugin' );
const { join, sep, basename } = require( 'path' );
const fastGlob = require( 'fast-glob' );
const { realpathSync } = require( 'fs' );

/**
* WordPress dependencies
*/
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
const { PhpFilePathsPlugin } = require( '@wordpress/scripts/utils' );

/**
* Internal dependencies
*/
const { baseConfig, plugins, stylesTransform } = require( './shared' );

/*
* Matches a block's filepaths in the form build-module/<filename>.js
*/
const blockViewRegex = new RegExp(
/build-module\/(?<filename>.*\/view.*).js$/
);

/**
* We need to automatically rename some functions when they are called inside block files,
* but have been declared elsewhere. This way we can call Gutenberg override functions, but
Expand All @@ -50,6 +41,7 @@ function escapeRegExp( string ) {
return string.replace( /[\\^$.*+?()[\]{}|]/g, '\\$&' );
}

<<<<<<< HEAD
const createEntrypoints = () => {
/*
* Returns an array of paths to block view files within the `@wordpress/block-library` package.
Expand Down Expand Up @@ -79,19 +71,18 @@ const createEntrypoints = () => {
}, {} );
};

=======
>>>>>>> ee59af9d23 (Build: Stop generating unused legacy scripts for core blocks)
module.exports = [
{
...baseConfig,
name: 'blocks',
entry: createEntrypoints(),
entry: {},
output: {
devtoolNamespace: 'wp',
filename: './build/block-library/blocks/[name].min.js',
path: join( __dirname, '..', '..' ),
},
plugins: [
...plugins,
new DependencyExtractionWebpackPlugin( { injectPolyfill: false } ),
new PhpFilePathsPlugin( {
context: './packages/block-library/src/',
props: [ 'render', 'variations' ],
Expand Down

0 comments on commit 4e736dd

Please sign in to comment.