Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Conversation

@thecrypticace
Copy link
Collaborator

Closes #134


We have a rule cache that we reuse — in contrast to normal tailwind which generates fresh rules every run. This is fine when rules are treated as immutable objects. However, aditional postcss plugins may not honor this contract.

For example, if you use css-loader and have url rewriting turned on (and it is by default) then css-loader will mutate the rules it gets from postcss-loader as it has the ability to use the postcss AST directly. This saves on memory but in our case causes an issue because these rule objects point directly to our cache.

Here we combat this by cloning the rules that go directly into the root node.

We have a rule cache that we reuse — in contrast to normal tailwind which generates fresh rules every run. This is fine when rules are treated as immutable objects. However, aditional postcss plugins may not honor this contract.

For example, if you use css-loader and have url rewriting turned on (and it is by default) then css-loader will mutate the rules it gets from postcss-loader as it has the ability to use the postcss AST directly. This saves on memory but in our case causes an issue because these rule objects point directly to our cache.

Here we combat this by cloning the rules that go directly into the root node.
@barnabasmolnar
Copy link
Contributor

Just gave this a go and it seems to solve #62 as well.

@adamwathan adamwathan merged commit fde976c into main Mar 22, 2021
@adamwathan
Copy link
Member

Legend! Thanks @thecrypticace ❤️

@adamwathan adamwathan deleted the feature/css-loader-compat-fix branch March 22, 2021 23:34
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.

Extending backgroundImage. Getting "Can't resolve '___CSS_LOADER_URL_REPLACEMENT_2___' "

4 participants