From c80220ad9b1fe60deeeb6798b988b2da9141f357 Mon Sep 17 00:00:00 2001 From: David Sevilla Martin <6401250+dsevillamartin@users.noreply.github.com> Date: Thu, 27 Jul 2023 06:22:14 -0400 Subject: [PATCH] fix(regression): Webpack not working on Windows with new export registry --- js-packages/webpack-config/src/autoExportLoader.cjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js-packages/webpack-config/src/autoExportLoader.cjs b/js-packages/webpack-config/src/autoExportLoader.cjs index 621f9990d..125596081 100644 --- a/js-packages/webpack-config/src/autoExportLoader.cjs +++ b/js-packages/webpack-config/src/autoExportLoader.cjs @@ -179,7 +179,9 @@ module.exports = function autoExportLoader(source) { // Get the path of the module to be exported // relative to the src directory. // Example: src/forum/components/UserCard.js => forum/components - const pathToModule = this.resourcePath.replace(path.resolve(this.rootContext, 'src') + '/', '').replace(/[A-Za-z_]+\.[A-Za-z_]+$/, ''); + const pathToModule = path.relative(path.resolve(this.rootContext, 'src'), this.resourcePath) + .replaceAll(path.sep, '/') + .replace(/[A-Za-z_]+\.[A-Za-z_]+$/, ''); return addAutoExports(source, pathToModule, moduleName); };