From ce00a5ff22c775b04aa5521687719f689996f45c Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Wed, 4 Dec 2024 18:37:55 +0100 Subject: [PATCH] DataViews build-wp: don't bundle singleton WordPress packages (#67590) Co-authored-by: jsnajdr Co-authored-by: youknowriad --- 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: /^\.[\.\/]/ }, () => {