Skip to content

Commit

Permalink
Fix incorrect resource URL in source map for @WordPress packages. (#5…
Browse files Browse the repository at this point in the history
…1401)

* Change the URL of the packages output in the source map.

---------

Co-authored-by: Aki Hamano <[email protected]>
  • Loading branch information
torounit and t-hamano authored Oct 5, 2023
1 parent 7ffd96d commit bd9a1cf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/webpack/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ module.exports = {
devtoolNamespace: 'wp',
filename: './build/[name]/index.min.js',
path: join( __dirname, '..', '..' ),
devtoolModuleFilenameTemplate: ( info ) => {
if ( info.resourcePath.includes( '/@wordpress/' ) ) {
const resourcePath =
info.resourcePath.split( '/@wordpress/' )[ 1 ];
return `../../packages/${ resourcePath }`;
}
return `webpack://${ info.namespace }/${ info.resourcePath }`;
},
},
plugins: [
...plugins,
Expand Down

0 comments on commit bd9a1cf

Please sign in to comment.