elm-webpack-loader
elm-webpack-loader copied to clipboard
Version 7.01 doesn't observe source code changes anymore
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
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!
Same is happening for me. I was using forceWatch: true
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
- usingnpx 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.
Having the same issue currently, any workarounds? I went back to 6.0.1
and everything is working fine.
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
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.
I had the same issue and adding the --watch
flag to the webpack-dev-server
command fixed the issue 👍
But --watch gave me a webpack 5 deprecation warning. That said, after remove. --watch, I seem to have everything working fine anyway - see https://github.com/simonh1000/elm-webpack-starter/pull/35 for code
at the end of the day, this is a webpack bug, and it might have been fixed. This issue should probably be closed
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.
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.
https://github.com/elm-community/elm-webpack-loader/issues/198
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.
Just for info, downgrading to webpack before 4.5 is incompatible with dev server see https://github.com/webpack/webpack-cli/issues/2422
had to install live-server
and run webpack --watch --mode=development
"webpack": "4.44.1",
"webpack-cli": "4.5.0"