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

webpack-dev-server not watching changes in my imports #130

Closed
newtonianb opened this issue Jul 26, 2015 · 11 comments
Closed

webpack-dev-server not watching changes in my imports #130

newtonianb opened this issue Jul 26, 2015 · 11 comments

Comments

@newtonianb
Copy link

I just setup webpack-dev-server below are some of my configs

assets/entry.js

require('./styles/style')

assets/styles/style.scss

@imports ('utilities/other_style.scss')
  • Changes to style.scss get detected and rebuilds
  • Changes to imported file other_style do not get detected

Is this supposed to work? What's the solution for this with webpack-dev-server and hot module replacement setup?

As a work around what I could do is have all my imports be required from my entry.js file (that works) the issue is what about my global SCSS variables and mixins, I would have to import them in each file, wouldn't that slow things down alot? What is the right way to go about this?

@newtonianb
Copy link
Author

Ok now I'm completely stuck

I tried to switch all my imports to require them directly with webpack but now I'm hitting the second bug
#100

So I can't use imports as they don't trigger webpack hot loader and I can't use require or node-sass craps out.

How are people dealing with this right now??

@jhnns
Copy link
Member

jhnns commented Jul 27, 2015

Does webpack recompile anything if you change a file? It could be that just HMR is not working.

I don't know about a watcher bug... what is your OS? Are any Symlinks involved (like via npm link or bower link?

@jhnns
Copy link
Member

jhnns commented Jul 27, 2015

Is that a duplicate of #102?

@newtonianb
Copy link
Author

From my entry point I require my main styles.scss
If I my make changes to scss the dev server detects these and recompile but if make changes to any of these imports it does not.

It isn't exactly the same issue as the other one as here even the first level import doesn't work.

@f0def
Copy link

f0def commented Jul 30, 2015

I met with the same problem, as described by the @newtonianb. I use windows 7, #102 is same issue

@janicduplessis
Copy link

I have the same issue. It seems to happen only on windows because on my mac it works fine.

@newtonianb
Copy link
Author

Thanks alot!

@jhnns
Copy link
Member

jhnns commented Aug 5, 2015

Could you guys check out the current master branch and check if it works for you? I've heavily refactored the import mechanism and need more tests.

@newtonianb
Copy link
Author

@jhnns just ran a quick test up to 3 level import, all looks good (win 8.1, npm 2.10.1) ! thanks alot

@newtonianb newtonianb reopened this Aug 5, 2015
@newtonianb
Copy link
Author

Actually there is something a bit dodgy although I can't confirm whether it's a new issue or from before

images/
--- my_file.png

styles/
--- my_style.scss
--- folder_a/
------ _my_other_style.scss

styles/my_style.scss

@import 'folder_a/my_other_style'

styles/folder_a/_my_other_style

// this works
background-image: url('../images/my_file.png');
// this doesn't work
background-image: url('../../images/my_file.png');
// this doesn't work
background-image: url('./../../images/my_file.png');

It seems my path is relative to the place it's being imported from? Is that normal?

I was expecting this to work background-image: url('../../images/my_file.png');

@jhnns
Copy link
Member

jhnns commented Aug 6, 2015

I have added a chapter to the README about url():
https://github.com/jtangelder/sass-loader#problems-with-url

It's way more complicated than in LESS which provides a mechanism that rewrites urls...

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

No branches or pull requests

4 participants