fix(regression): Webpack not working on Windows with new export registry

This commit is contained in:
David Sevilla Martin 2023-07-27 06:22:14 -04:00 committed by GitHub
parent 3593d53795
commit c80220ad9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
};