parent
31b647343e
commit
5fb6fc78bc
@ -1,7 +1,7 @@
|
|||||||
import { existsSync, readFileSync } from 'fs';
|
import { existsSync, readFileSync } from 'fs';
|
||||||
import { NormalModuleReplacementPlugin } from 'webpack';
|
import { NormalModuleReplacementPlugin } from 'webpack';
|
||||||
import { normalizePath, joinPathFragments, workspaceRoot } from '@nrwl/devkit';
|
import { joinPathFragments, workspaceRoot } from '@nrwl/devkit';
|
||||||
import { dirname } from 'path';
|
import { dirname, join, normalize } from 'path';
|
||||||
import { ParsedCommandLine } from 'typescript';
|
import { ParsedCommandLine } from 'typescript';
|
||||||
import {
|
import {
|
||||||
getRootTsConfigPath,
|
getRootTsConfigPath,
|
||||||
@ -40,9 +40,7 @@ export function shareWorkspaceLibraries(
|
|||||||
const pathMappings: { name: string; path: string }[] = [];
|
const pathMappings: { name: string; path: string }[] = [];
|
||||||
for (const [key, paths] of Object.entries(tsconfigPathAliases)) {
|
for (const [key, paths] of Object.entries(tsconfigPathAliases)) {
|
||||||
if (libraries && libraries.includes(key)) {
|
if (libraries && libraries.includes(key)) {
|
||||||
const pathToLib = normalizePath(
|
const pathToLib = normalize(join(workspaceRoot, paths[0]));
|
||||||
joinPathFragments(workspaceRoot, paths[0])
|
|
||||||
);
|
|
||||||
pathMappings.push({
|
pathMappings.push({
|
||||||
name: key,
|
name: key,
|
||||||
path: pathToLib,
|
path: pathToLib,
|
||||||
@ -71,10 +69,10 @@ export function shareWorkspaceLibraries(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const from = req.context;
|
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) {
|
for (const library of pathMappings) {
|
||||||
const libFolder = normalizePath(dirname(library.path));
|
const libFolder = normalize(dirname(library.path));
|
||||||
if (!from.startsWith(libFolder) && to.startsWith(libFolder)) {
|
if (!from.startsWith(libFolder) && to.startsWith(libFolder)) {
|
||||||
req.request = library.name;
|
req.request = library.name;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user