diff --git a/tools/webpack/packages.js b/tools/webpack/packages.js index e5bb74abdb0a1f..0d035e5377f709 100644 --- a/tools/webpack/packages.js +++ b/tools/webpack/packages.js @@ -142,6 +142,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,