Skip to content

Commit 6b0d77e

Browse files
committed
fix pathing in Windows
1 parent d6fbf39 commit 6b0d77e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/webpack/src/loader.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ function _removeDecorators(fileName: string, source: string): string {
2727

2828

2929
function _replaceBootstrap(fileName: string, source: string, plugin: NgcWebpackPlugin) {
30-
const basePath = plugin.angularCompilerOptions.basePath;
31-
const entryModuleFileName = plugin.entryModule.split('#')[0] + '.ngfactory';
30+
const basePath = path.normalize(plugin.angularCompilerOptions.basePath);
31+
const genDir = path.normalize(plugin.genDir);
32+
const dirName = path.normalize(path.dirname(fileName));
33+
const entryModuleFileName = path.normalize(plugin.entryModule.split('#')[0] + '.ngfactory');
3234
const relativeEntryModulePath = path.relative(basePath, entryModuleFileName);
33-
const fullEntryModulePath = path.resolve(plugin.genDir, relativeEntryModulePath);
34-
const ngFactoryPath = './' + path.relative(path.dirname(fileName), fullEntryModulePath);
35+
const fullEntryModulePath = path.resolve(genDir, relativeEntryModulePath);
36+
const relativeNgFactoryPath = path.relative(dirName, fullEntryModulePath);
37+
const ngFactoryPath = './' + relativeNgFactoryPath.replace(/\\/g, '/');
3538

3639
return source
3740
.replace(/(import.*)\bplatformBrowserDynamic\b(.*\/)platform-browser-dynamic(\b.*)$/m,

0 commit comments

Comments
 (0)