|
8 | 8 |
|
9 | 9 | import { BuilderContext } from '@angular-devkit/architect'; |
10 | 10 | import type { Plugin } from 'esbuild'; |
| 11 | +import { realpathSync } from 'node:fs'; |
11 | 12 | import { access, constants } from 'node:fs/promises'; |
12 | 13 | import { createRequire } from 'node:module'; |
13 | 14 | import path from 'node:path'; |
@@ -83,7 +84,17 @@ export async function normalizeOptions( |
83 | 84 | options: ApplicationBuilderInternalOptions, |
84 | 85 | plugins?: Plugin[], |
85 | 86 | ) { |
86 | | - const workspaceRoot = context.workspaceRoot; |
| 87 | + // If not explicitly set, default to the Node.js process argument |
| 88 | + const preserveSymlinks = |
| 89 | + options.preserveSymlinks ?? process.execArgv.includes('--preserve-symlinks'); |
| 90 | + |
| 91 | + // Setup base paths based on workspace root and project information |
| 92 | + const workspaceRoot = preserveSymlinks |
| 93 | + ? context.workspaceRoot |
| 94 | + : // NOTE: promises.realpath should not be used here since it uses realpath.native which |
| 95 | + // can cause case conversion and other undesirable behavior on Windows systems. |
| 96 | + // ref: https://github.com/nodejs/node/issues/7726 |
| 97 | + realpathSync(context.workspaceRoot); |
87 | 98 | const projectMetadata = await context.getProjectMetadata(projectName); |
88 | 99 | const projectRoot = normalizeDirectoryPath( |
89 | 100 | path.join(workspaceRoot, (projectMetadata.root as string | undefined) ?? ''), |
@@ -258,7 +269,6 @@ export async function normalizeOptions( |
258 | 269 | serviceWorker, |
259 | 270 | poll, |
260 | 271 | polyfills, |
261 | | - preserveSymlinks, |
262 | 272 | statsJson, |
263 | 273 | stylePreprocessorOptions, |
264 | 274 | subresourceIntegrity, |
@@ -289,8 +299,7 @@ export async function normalizeOptions( |
289 | 299 | poll, |
290 | 300 | progress, |
291 | 301 | externalPackages, |
292 | | - // If not explicitly set, default to the Node.js process argument |
293 | | - preserveSymlinks: preserveSymlinks ?? process.execArgv.includes('--preserve-symlinks'), |
| 302 | + preserveSymlinks, |
294 | 303 | stylePreprocessorOptions, |
295 | 304 | subresourceIntegrity, |
296 | 305 | serverEntryPoint, |
|
0 commit comments