From 0617fa2befac186e967d080e621df10d9592ceaa Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Wed, 4 Dec 2024 17:48:46 +0100 Subject: [PATCH] DataViews build-wp: don't bundle singleton WordPress packages --- packages/dataviews/build.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/dataviews/build.js b/packages/dataviews/build.js index 582826d18c1847..e156b1cb875af0 100644 --- a/packages/dataviews/build.js +++ b/packages/dataviews/build.js @@ -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: /^\.[\.\/]/ }, () => {