elm-community/elm-webpack-loader

This loader should not expect `--watch` for the dev server

sporto opened this issue ยท 9 comments

In version 4.4.0 of the webpack cli you could pass a --watch flag like:

webpack serve --watch

This will make this loader rebuild files on changes.

In version 4.5 of the CLI passing that flag is an error:

webpack/webpack-cli#2401

The watching should happen automatically. Which indeed happens with CSS and Typescript files. But not with Elm file.

The loader should watch file without the --watch flag.

The actual configuration that works for me is adding watch in the webpack config. e.g.

{
  ...
   watch: true
}

Will close this and make a PR for the readme

The watch: true worked with the webpack cli version 4.4.0. But doesn't with 4.5.0.
Unsure what is going on.

In https://webpack.js.org/configuration/watch/ it says that In webpack-dev-server and webpack-dev-middleware watch mode is enabled by default.

However when running the server I get compiler.options.watch == false

if (compiler.options.watch) {

It appears that is not the proper way to do it anymore.

Fixed in #199

This is getting increasingly painful. Hope the PR can be merged quickly

We may have to publish it ourselves.

#199 was merged

This will be on npm in the next day or so, but in the mean time you can put "elm-community/elm-webpack-loader#8.0.0" as the elm-webpack-loader version in your package.json and it will grab the package directly from github. If you do this you might need to go into node_modules and delete the elm-webpack-loader directory first.

@lukewestby Any update on when we can expect version 8.0.0 to be available on npm?