Skip to content

Do not use global cache #115

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 2 commits into from
May 18, 2017
Merged

Conversation

mxl
Copy link
Contributor

@mxl mxl commented May 17, 2017

Currently when running css-modulesify first time passed postcss plugins are cached in loader and the subsequent runs in the same process but with different set of plugins result in using cached plugins. The only workaround is to reload module with delete require.cache[require.resolve('css-modulesify')];.

This is happening because of persisting cache globally that was made because cache option passed to browserify is forwarded to module-deps where it's filled with record for each module (record for css module contains javascript code generated with cmify.js). So without persisting tokens and loader between runs when using browserify cache option (e.g. with rebundler) if css file is not changed then file record is not removed from browserify cache and module-deps does not reapply transformations and css (which is "side-effect" of transformations) is not outputted which was the #32 issue reported by @joeybaker and was fixed by him in #40 by introducing global cache.

Persisting cache globally results in issue like I described above and I suggest to use cache option that can be reused between runs. So it makes css-modulesify stateless again but allows to persist cache e.g. for using with rebundler.

Michael Ledin added 2 commits May 17, 2017 15:34
…parate function. Use cache option instead of global cache.
@mxl mxl force-pushed the do-not-use-global-cache branch from a22b03f to 1e817d1 Compare May 17, 2017 15:53
@joshwnj
Copy link
Member

joshwnj commented May 17, 2017

Thanks @mxl ! What you've described sounds good. I'll take a look and then we should be good to go ahead and merge.

@joshwnj joshwnj merged commit afe6750 into css-modules:master May 18, 2017
@joshwnj
Copy link
Member

joshwnj commented May 18, 2017

published to npm v0.28.0

@mxl mxl deleted the do-not-use-global-cache branch May 18, 2017 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants