Skip to content

Commit

Permalink
DataViews build-wp: don't bundle singleton WordPress packages (#67590)
Browse files Browse the repository at this point in the history
Co-authored-by: jsnajdr <[email protected]>
Co-authored-by: youknowriad <[email protected]>
  • Loading branch information
3 people authored Dec 4, 2024
1 parent 532b8e2 commit ce00a5f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/dataviews/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ const esbuild = require( 'esbuild' );
const wpExternals = {
name: 'wordpress-externals',
setup( build ) {
build.onResolve(
{ filter: /^@wordpress\/(data|hooks|i18n)(\/|$)/ },
( args ) => {
// Don't bundle WordPress signleton packages
return { path: args.path, external: true };
}
);
build.onResolve( { filter: /^@wordpress\// }, () => {
// Bundle wordpress packages
// Bundle WordPress packages
return { external: false };
} );
build.onResolve( { filter: /^\.[\.\/]/ }, () => {
Expand Down

0 comments on commit ce00a5f

Please sign in to comment.