elm-css-webpack-loader icon indicating copy to clipboard operation
elm-css-webpack-loader copied to clipboard

Webpack 3 issues (I know, only Webpack 2 is supported but 2 -> 3 should have been non-breaking)

Open NeverwinterMoon opened this issue 7 years ago • 3 comments

EDIT: OK, it seems I was too sleepy when comparing Webpack 2 and 3, so the problem is not only Webpack 3-specific. It's the same with 2 as well. The only good solution for me was to run elm make before running webpack during the deployment.

So, Webpack 3 came out some time ago. As promised (https://medium.com/webpack/webpack-3-official-release-15fd2dd8f07b), it had no breaking functionality and all the web pack loaders I used in two different projects were able to work without any errors when moving from 2 -> 3. Except elm-css-webpack-loader (in combination with elm-webpack-loader).

So, what I get is this:

> webpack

Starting downloads...

  ● elm-lang/navigation 2.1.0
  ● NoRedInk/elm-decode-pipeline 3.0.0
  ● elm-community/random-extra 2.0.0
  ● elm-lang/dom 1.1.1
  ● elm-lang/geolocation 1.0.2
  ● elm-lang/virtual-dom 2.0.4
  ● krisajenkins/remotedata 4.3.0
  ● elm-lang/html 2.0.0
  ● elm-lang/http 1.0.0
  ● rtfeldman/elm-css 9.1.0
  ● rtfeldman/elm-css-util 1.0.2
  ● rtfeldman/hex 1.0.0
  ● rtfeldman/elm-css-helpers 2.1.0
elm-make: elm-lang-core-7fc14f2: rename: unsatisfied constraints (Directory not empty)

I think, because I have 2 requires:

require '../elm/Stylesheets.elm'
Elm = require '../elm/Main.elm'

... with 2 different loaders (per example configuration), so elm-webpack-loader loads elm files except Stylesheets and elm-css-webpack-loader loads only Stylesheets, both loaders start elm make and they try to download Elm dependencies at the the same time. If I re-ran the same job the second time, it passes. If I remove the elm-stuff directory and run the build, it will fail again.

Also, if I only have one of the requires (Main.elm or Stylesheets.elm), the build also passes on the first run.

~~Everything works with exactly the same configuration and Webpack 2.~~ (read the edit)

NeverwinterMoon avatar Jul 22 '17 22:07 NeverwinterMoon

I get the same issue with webpack 3, however, a workaround is very simple: run elm package install before webpack.

PS. Here's a PR with the peerDependency update: https://github.com/tcoopman/elm-css-webpack-loader/pull/21

gkubisa avatar Aug 27 '17 21:08 gkubisa

Reading the issues it doesn't seem that #21 is a fix for this?

tcoopman avatar Aug 29 '17 08:08 tcoopman

You're right #21 is not a fix - it just avoids a dependency conflict reported by npm.

My point is that the reported issue isn't really a big problem in practice and has a trivial workaround, so it might be ok to merge #21 regardless. I wouldn't even come across this problem myself, while the dependency conflict is very obvious.

It's just my opinion - do whatever you think is best. :-)

gkubisa avatar Aug 30 '17 09:08 gkubisa