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 <54422211+t-hamano@users.noreply.github.com>
  • Loading branch information
2 people authored and noahtallen committed Oct 10, 2023
1 parent f165a67 commit f810926
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 f810926

Please sign in to comment.