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

Fix context cache when using literal config object instead of file #11

Merged
merged 1 commit into from
Mar 13, 2021

Conversation

bradlc
Copy link
Contributor

@bradlc bradlc commented Mar 12, 2021

No description provided.

contextMap.set(sourcePath, context)
return context
// If the config used already exists in the cache, return that.
if (configContextMap.has(tailwindConfigHash)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this need && !isConfigFile?

Copy link
Member

Choose a reason for hiding this comment

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

I... don't know 😅 I don't think so, I think this is right. If we don't have a context in the map for the current source path (real world example is MyComponent.vue with a style block), we want to try and reuse the context based on the config hash and then set up that source path in the map. True even if there's a config file if I'm not missing something.

@atinux
Copy link
Contributor

atinux commented Mar 13, 2021

I just tried this branch on Nuxt + Webpack + Tailwind module and it fixes the HMR issue when using the config object 👍

@adamwathan adamwathan merged commit 750bcc2 into master Mar 13, 2021
@adamwathan adamwathan deleted the fix-config-object-context-cache branch March 15, 2021 16:46
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.

3 participants