File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ build_files=$(
114114 build/block-library/blocks/* .php \
115115 build/block-library/blocks/* /block.json \
116116 build/block-library/blocks/* /* .css \
117+ build/block-library/blocks/* /* .js \
117118 build/edit-widgets/blocks/* /block.json \
118119)
119120
Original file line number Diff line number Diff line change @@ -135,16 +135,19 @@ module.exports = {
135135 entry : createEntrypoints ( ) ,
136136 output : {
137137 devtoolNamespace : 'wp' ,
138- filename : ( data ) => {
139- const { chunk } = data ;
138+ filename : ( pathData ) => {
139+ const { chunk } = pathData ;
140140 const { entryModule } = chunk ;
141- const { rawRequest } = entryModule ;
141+ const { rawRequest, rootModule } = entryModule ;
142142
143- /*
144- * If the file being built is a Core Block's frontend file,
145- * we build it in the block's directory.
146- */
147- if ( rawRequest && rawRequest . includes ( '/frontend.js' ) ) {
143+ // When processing ESM files, the requested path
144+ // is defined in `entryModule.rootModule.rawRequest`, instead of
145+ // being present in `entryModule.rawRequest`.
146+ // In the context of frontend files, they would be processed
147+ // as ESM if they use `import` or `export` within it.
148+ const request = rootModule ?. rawRequest || rawRequest ;
149+
150+ if ( request . includes ( '/frontend.js' ) ) {
148151 return `./build/block-library/blocks/[name]/frontend.js` ;
149152 }
150153
You can’t perform that action at this time.
0 commit comments