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

Version 7.01 doesn't observe source code changes anymore #193

Open
sporto opened this issue Aug 28, 2020 · 14 comments
Open

Version 7.01 doesn't observe source code changes anymore #193

sporto opened this issue Aug 28, 2020 · 14 comments

Comments

@sporto
Copy link
Contributor

sporto commented Aug 28, 2020

In version 6.01 making a change in the source will cause webpack to re-compile the changes.
Nothing happens in version 7.01 now. The only way to get the changes is by kiling the dev server and running again.
I'm using Ubuntu 20.04

To replicate

  • Create a basic project e.g. the example folder in the repo.
    Example: https://github.com/sporto/elm-webpack-7-repro

  • Install version 6.01

  • Run npm run dev

  • Open the browser, see Hello ...

  • Make a change in the Content.elm, observe the change in the browser

  • Then repeat using version 7.01

  • Observe how the page doesn't change when changing the code

@sporto sporto changed the title Version 7.01 doesn't observer changes anymore Version 7.01 doesn't observe source code changes anymore Aug 28, 2020
@maxfarseer
Copy link

maxfarseer commented Sep 2, 2020

Agree here. I came to the same issue yesterday.
OS X, version 10.15.6 (19G2021)
p.s. also error message way more nicer in version 6.0.1
p.p.s. thx for your loader!

@rlopzc
Copy link

rlopzc commented Sep 2, 2020

Same is happening for me. I was using forceWatch: true

@IloSophiep
Copy link

I'm also having this problem. To add some info that seems to be the case for me:

  • The problem only happens when using npx webpack-dev-server - using npx webpack --watch seems to still work just fine?
  • It only affects the file not referenced in my webpack entry point javascript file. So changes in Main.elm do trigger a recompile, while changes in other files (not referenced in JS files) do not.

@dccarmo
Copy link

dccarmo commented Sep 10, 2020

Having the same issue currently, any workarounds? I went back to 6.0.1 and everything is working fine.

@jhillyerd
Copy link

jhillyerd commented Sep 13, 2020

Ran into the same issue today, adding --watch to my dev server script solved it:

    "dev": "webpack-dev-server --mode development --port 3000 --hot --watch",

However, my hot reload errors are still broken, instead of the elm compiler output, I just get this in the browser modal overlay:

Failed to compile.

./src/Main.elm
Module build failed (from ./node_modules/elm-webpack-loader/index.js):
Compiler process exited with error Compilation failed

Configs I'm using:

https://github.com/inbucket/inbucket/blob/cf4c5a29bb05bd029221c890ea5ff9842ba295cb/ui/package.json
https://github.com/inbucket/inbucket/blob/cf4c5a29bb05bd029221c890ea5ff9842ba295cb/ui/webpack.config.js

dbrgn added a commit to gfroerli/web that referenced this issue Oct 13, 2020
@sporto
Copy link
Contributor Author

sporto commented Nov 11, 2020

We upgraded to Webpack 5 and this works fine provided that you have --watch.
In version 6 of this plugin somehow the flag --watch was not necessary.

@rdelgatte
Copy link

I had the same issue and adding the --watch flag to the webpack-dev-server command fixed the issue 👍

@simonh1000
Copy link
Contributor

But --watch gave me a webpack 5 deprecation warning.
That said, after remove. --watch, I seem to have everything working fine anyway - see simonh1000/elm-webpack-starter#35 for code

@simonh1000
Copy link
Contributor

at the end of the day, this is a webpack bug, and it might have been fixed. This issue should probably be closed

SidneyNemzer added a commit to SidneyNemzer/helium-3 that referenced this issue Dec 1, 2020
@DawidJanczak
Copy link

This bug is still a thing, but it only occurs for files that are imported from other files. Entry points load just fine, that's why it's working in that example repo @simonh1000 - there's only one Elm file there. Adding --watch option to webpack does work, however it recompiles all the files instead of just the one that's been changed.

@sporto
Copy link
Contributor Author

sporto commented Feb 3, 2021

As of version 4.5.0 of the webpack cli you cannot pass --watch anymore to the dev server.
ie. webpack serve --watch will throw an error.

Without --watch the loader doesn't recompile changes. So atm this loader seems to be incompatible with webpack-cli 4.5. Unless I'm missing some options that need to be passed somewhere else.

#198

@ocharles
Copy link

I'd like to suggest we bring back forceWatch for a different reason - using this with Storybook. Storybook seems to run its own server which means compiler.watching is false. I'm not entirely sure if that can be fixed, but right now it means that I can't get proper dependency tracking in Storybook at all, which really sucks. Just having this flag and letting me set it in my Storybook Webpack config would unblock me.

@wadouk
Copy link

wadouk commented Mar 8, 2021

Just for info, downgrading to webpack before 4.5 is incompatible with dev server see webpack/webpack-cli#2422

@wadouk
Copy link

wadouk commented Mar 8, 2021

had to install live-server and run webpack --watch --mode=development

    "webpack": "4.44.1",
    "webpack-cli": "4.5.0"

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