Skip to content
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

fix(webpack): fix loader config for global styles #14323

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Jan 12, 2023

This PR fixes an issue with global stylesheets specified via styles option in @nrwl/webpack:webpack executor.

Now that raw-css-loader is removed (replaced by css-loader) there are some options we need to set to make it work.

Current Behavior

Using url(...) in stylesheets, such as background-image: url(/'assets/bg.png') results in an error since css-loader is resolving the URL.

Expected Behavior

Using url(...) should work.

Related Issue(s)

Fixes #

@vercel
Copy link

vercel bot commented Jan 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
nx-dev ⬜️ Ignored (Inspect) Jan 12, 2023 at 10:32PM (UTC)

@@ -432,6 +475,26 @@ function getCommonLoadersForGlobalCss(
];
}

function getCommonLoadersForGlobalStyle(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this separate from getCommonLoadersForGlobalCss, because there are minor differences and we want to avoid bad abstractions like we did previously.

@@ -214,35 +214,78 @@ export function withWeb() {
},
];

const rules: RuleSetRule[] = [
const globalStyleRules: RuleSetRule[] = [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand global stylesheets to process less, stylus as well. It was missed previously.

@jaysoo jaysoo force-pushed the fix/webpack-global-styles branch 2 times, most recently from 6497be2 to d1af744 Compare January 12, 2023 22:26
@jaysoo jaysoo merged commit a610276 into nrwl:master Jan 12, 2023
@jaysoo jaysoo deleted the fix/webpack-global-styles branch January 12, 2023 22:59
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants