elm-community/elm-webpack-loader

addDirDependency question

Opened this issue · 2 comments

Hello!

I'm trying to fix an issue we're having where saving a single Elm file when running webpack-dev-server causes multiple "Compiling Elm files..." lines and in general takes a long while to recompile. Our project structure is a bit specific since we have a separate project containing webpack and all the libs and our main project contains only source files. Something like this:

main_project
  assets/components/elm <- contains elm-package.json and subdirectories for Elm apps
webpack_project
  webpack.config.js

Webpack dev server is run from within webpack_project. I need to pass cwd in order for the files to be even located (cwd points to ../main_project/assets/components/elm). Also my elm-package.json's source-directories contains only one entry: '.'

Now I think the issue is connected to this call https://github.com/elm-community/elm-webpack-loader/blob/master/index.js#L98 When I comment it out everything works fine and the recompilation takes a second. I printed out contents of dirs from the line above and it's a single entry equal to cwd. When I uncomment addDirDependency that single entry is printed out multiple times. Any idea what this might be?

🤔 That sounds like the dependency solving has gotten a bit weird. Perhaps you can ask on Slack (#webpack) and someone may be able to hepl

So this looks like a generic webpack issue rather than loader? I'm asking because this issue does not occur with files using other loaders (e.g. coffee, React), just Elm ones.