SASS and `@import` dependencies not busting
juanca opened this issue · 6 comments
- Version 1.2.0
- I cannot seem to produce this on a vanilla project. I'm still trying though.
- (My computer) Node version 6.11.4, OSX 10.12.6 -- this actually happens across many computers in my office, Sierra and High Sierra
Here's how I can reproduce this in my private repository:
I have a dependency chain (which is convoluted due to legacy reasons):
application.html.erb_internal_css.html.erbapp/assets/stylesheets/internal-base.scss(which is processed via Webpack and its bundled path available in Rail ERB partials).app/assets/stylesheets/internal/base/index.scssapp/assets/stylesheets/internal/base/shared.scss
Here are the relevant contents (with the issue) of my stylesheets:
app/assets/stylesheets/internal-base.scss:
... a bunch of imports (~38)
@import "./internal/base/index";
app/assets/stylesheets/internal/base/index.scss:
... ~8 imports
@import "./shared";
... ~4 imports
app/assets/stylesheets/internal/base/shared.scss:
... ~7 imports
... ~2000 lines of SASS
Any changes to the shared.scss will not bust the cache! Changes to base/index.scss will also not bust the cache! However, changes to internal-base.scss will bust the cache!
In order for changes to get picked up in shared.scss, I have to provide an the .scss extension in the @import statement for internal-base.scss. That is the only change to get it tracked well by cache-loader. base/index.scss remains the same -- which is a bit odd.
I'm still trying to reproduce in a vanilla repository @ https://github.com/juanca/cache-loader-sass-bug
It might have to do with my webpack configuration in my private repository... I can provide snippets from it as requested.
Anyone had similar problems to these? Or are these known issues?
Here are some interesting things about my webpack configuration:
Happypack@ 4 threads per loaderExtractTextWebpackPluginfor dev (to mimic prod)
Does this also happen without happypack ? Could you share a reproducible test repo for debugging ?
I will remove happypack and report back. Might be a few days
Oh, that was it. Webpack recompiles when I touch app/assets/stylesheets/internal/base/shared.scss now that I removed happypack completely.
I even tried setting the thread count to 1 but the bug still persisted.
I'll see if I can update my repro repo!
Aw man, I can't really reproduce. :(
The private repo is a monolithic codebase so perhaps it's related to large number of files? Perhaps its the way we configured happypack? We use 8 different happypack loaders.
I am unfortunately no longer using cache-loader (due to a different reason). Welcome to carry the torch or close this issue.