Skip to content

fix(@angular/build): prevent build failures with remote CSS imports when Tailwind is configured #28116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2024
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 @@ -63,7 +63,7 @@ export function createStylesheetBundleOptions(
];

if (options.inlineFonts) {
plugins.push(createCssInlineFontsPlugin({ cache, cacheOptions: options.cacheOptions }));
plugins.unshift(createCssInlineFontsPlugin({ cache, cacheOptions: options.cacheOptions }));
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class StylesheetPluginFactory {

// Add a load callback to support files from disk
build.onLoad(
{ filter: language.fileFilter },
{ filter: language.fileFilter, namespace: 'file' },
createCachedLoad(cache, async (args) => {
const data = await readFile(args.path, 'utf-8');

Expand Down
9 changes: 8 additions & 1 deletion tests/legacy-cli/e2e/tests/build/styles/tailwind-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ export default async function () {
await writeFile('src/app/app.component.css', '@tailwind base; @tailwind components;');

// Add Tailwind directives to a global style
await writeFile('src/styles.css', '@tailwind base; @tailwind components;');
await writeFile(
'src/styles.css',
`
@import url(https://fonts.googleapis.com/css?family=Roboto:400);
@tailwind base;
@tailwind components;
`,
);

// Ensure installation warning is present
const { stderr } = await ng('build', '--configuration=development');
Expand Down