Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export function getStylesConfig(wco: WebpackConfigOptions) {
resolvedPath = require.resolve(style.input, { paths: [root] });
} catch {}
}

if (!buildOptions.preserveSymlinks) {
resolvedPath = fs.realpathSync(resolvedPath);
}

// Add style entry points.
if (entryPoints[style.bundleName]) {
entryPoints[style.bundleName].push(resolvedPath);
Expand Down
34 changes: 34 additions & 0 deletions tests/legacy-cli/e2e/tests/build/styles/symlinked-global.ts
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');
}