Skip to content

Commit

Permalink
Use URLs for improved cross platform support
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Sep 10, 2024
1 parent 5bf5899 commit f5e2162
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/webpack/script-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { baseConfig, plugins } = require( './shared' );
const WORDPRESS_NAMESPACE = '@wordpress/';
const { createRequire } = require( 'node:module' );

const rootPath = `${ __dirname }/../../`;
const rootPath = new URL( '..', `file://${ __dirname }` );
const fromRootRequire = createRequire( rootPath );

/** @type {Iterable<[string, string]>} */
Expand All @@ -35,7 +35,7 @@ for ( const [ packageName, versionSpecifier ] of iterableDeps ) {
continue;
}
const packageRequire = createRequire(
`${ rootPath }/${ versionSpecifier.substring( 5 ) }/`
new URL( `${ versionSpecifier.substring( 5 ) }/`, rootPath )
);
const depPackageJson = packageRequire( './package.json' );
if ( ! Object.hasOwn( depPackageJson, 'wpScriptModuleExports' ) ) {
Expand Down

0 comments on commit f5e2162

Please sign in to comment.