Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular-devkit/build-angular): correctly resolve symlinked globa…
…l styles entrypoints With this change we resolve the global stylesheet entrypoint path to use the realpath instead of the symlink path. Fixes #3500 (cherry picked from commit 1df8a3d)
- Loading branch information
1 parent
a7535db
commit 0b96aa4
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tests/legacy-cli/e2e/tests/build/styles/symlinked-global.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { symlinkSync } from 'fs'; | ||
import { resolve } from 'path'; | ||
import { expectFileToMatch, writeMultipleFiles } from '../../../utils/fs'; | ||
import { ng } from '../../../utils/process'; | ||
import { updateJsonFile } from '../../../utils/project'; | ||
|
||
export default async function () { | ||
await writeMultipleFiles({ | ||
'src/styles.scss': `p { color: red }`, | ||
'src/styles-for-link.scss': `p { color: blue }`, | ||
}); | ||
|
||
symlinkSync( | ||
resolve('src/styles-for-link.scss'), | ||
resolve('src/styles-linked.scss'), | ||
'junction', | ||
); | ||
|
||
await updateJsonFile('angular.json', workspaceJson => { | ||
const appArchitect = workspaceJson.projects['test-project'].architect; | ||
appArchitect.build.options.styles = [ | ||
'src/styles.scss', | ||
'src/styles-linked.scss', | ||
]; | ||
}); | ||
|
||
await ng('build'); | ||
await expectFileToMatch('dist/test-project/styles.css', 'red'); | ||
await expectFileToMatch('dist/test-project/styles.css', 'blue'); | ||
|
||
await ng('build', '--preserve-symlinks'); | ||
await expectFileToMatch('dist/test-project/styles.css', 'red'); | ||
await expectFileToMatch('dist/test-project/styles.css', 'blue'); | ||
} |