Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(angular): path normalize was in correct on windows #9861 #9881

Merged
merged 1 commit into from Apr 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions packages/angular/src/utils/mfe/mfe-webpack.ts
@@ -1,7 +1,7 @@
import { existsSync, readFileSync } from 'fs';
import { NormalModuleReplacementPlugin } from 'webpack';
import { normalizePath, joinPathFragments, workspaceRoot } from '@nrwl/devkit';
import { dirname } from 'path';
import { joinPathFragments, workspaceRoot } from '@nrwl/devkit';
import { dirname, join, normalize } from 'path';
import { ParsedCommandLine } from 'typescript';
import {
getRootTsConfigPath,
Expand Down Expand Up @@ -40,9 +40,7 @@ export function shareWorkspaceLibraries(
const pathMappings: { name: string; path: string }[] = [];
for (const [key, paths] of Object.entries(tsconfigPathAliases)) {
if (libraries && libraries.includes(key)) {
const pathToLib = normalizePath(
joinPathFragments(workspaceRoot, paths[0])
);
const pathToLib = normalize(join(workspaceRoot, paths[0]));
pathMappings.push({
name: key,
path: pathToLib,
Expand Down Expand Up @@ -71,10 +69,10 @@ export function shareWorkspaceLibraries(
}

const from = req.context;
const to = normalizePath(joinPathFragments(req.context, req.request));
const to = normalize(join(req.context, req.request));

for (const library of pathMappings) {
const libFolder = normalizePath(dirname(library.path));
const libFolder = normalize(dirname(library.path));
if (!from.startsWith(libFolder) && to.startsWith(libFolder)) {
req.request = library.name;
}
Expand Down