File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
packages/angular_devkit/build_angular/src/webpack/configs
tests/legacy-cli/e2e/tests/build Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -334,8 +334,17 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
334
334
watch : buildOptions . watch ,
335
335
watchOptions : {
336
336
poll,
337
+ // The below is needed as when preserveSymlinks is enabled we disable `resolve.symlinks`.
338
+ followSymlinks : buildOptions . preserveSymlinks ,
337
339
ignored : poll === undefined ? undefined : '**/node_modules/**' ,
338
340
} ,
341
+ snapshot : {
342
+ module : {
343
+ // Use hash of content instead of timestamp because the timestamp of the symlink will be used
344
+ // instead of the referenced files which causes changes in symlinks not to be picked up.
345
+ hash : buildOptions . preserveSymlinks ,
346
+ } ,
347
+ } ,
339
348
performance : {
340
349
hints : false ,
341
350
} ,
Original file line number Diff line number Diff line change
1
+ import { symlink } from 'fs/promises' ;
2
+ import { resolve } from 'path' ;
3
+ import { appendToFile , expectFileToMatch , writeMultipleFiles } from '../../utils/fs' ;
4
+ import { execAndWaitForOutputToMatch , waitForAnyProcessOutputToMatch } from '../../utils/process' ;
5
+ import { updateJsonFile } from '../../utils/project' ;
6
+
7
+ const buildReadyRegEx = / B u i l d a t : / ;
8
+
9
+ export default async function ( ) {
10
+ await updateJsonFile ( 'angular.json' , ( configJson ) => {
11
+ configJson . projects [ 'test-project' ] . architect . build . options . preserveSymlinks = true ;
12
+ } ) ;
13
+
14
+ await writeMultipleFiles ( {
15
+ 'src/link-source.ts' : '// empty file' ,
16
+ 'src/main.ts' : `import './link-dest';` ,
17
+ } ) ;
18
+
19
+ await symlink ( resolve ( 'src/link-source.ts' ) , resolve ( 'src/link-dest.ts' ) ) ;
20
+
21
+ await execAndWaitForOutputToMatch (
22
+ 'ng' ,
23
+ [ 'build' , '--watch' , '--configuration=development' ] ,
24
+ buildReadyRegEx ,
25
+ ) ;
26
+
27
+ // Trigger a rebuild
28
+ await appendToFile ( 'src/link-source.ts' , `console.log('foo-bar');` ) ;
29
+ await waitForAnyProcessOutputToMatch ( buildReadyRegEx ) ;
30
+ await expectFileToMatch ( 'dist/test-project/main.js' , `console.log('foo-bar')` ) ;
31
+ }
You can’t perform that action at this time.
0 commit comments