Giter Club home page Giter Club logo

Comments (10)

sentience avatar sentience commented on July 30, 2024

@sporto Have you set the recommended cwd option for elm-webpack-loader in your Webpack config? As of elm-webpack-loader 4.0, this changes how the loader monitors for changed files. With it, elm-webpack-loader watches the contents of all of the source directories mentioned in your elm-package.json file; without it, elm-webpack-loader asks node-elm-compiler for a list of Elm files to monitor, and node-elm-compiler’s implementation basically ignores library files (or any files not in the same directory tree as the source file(s) loaded by Webpack).

I’m hopeful that if you aren’t currently setting the cwd option, setting it will resolve your issue. As a nice side-benefit, it will also improve performance (because node-elm-compiler’s dependency listing was previously identified as slow).

from elm-webpack-loader.

sporto avatar sporto commented on July 30, 2024

Thanks @sentience I just tried that. I set cwd to my root library folder.

But then I get a webpack error saying that it cannot find the example files e.g.

I cannot find module 'Example1'.

Module 'Main' is trying to import it.

So by setting cwd to that folder now the loader is using the elm-package.json located in the root, this elm-package doesn't have the source directories for the example. I want to run webpack with the example/elm-package.json.

If I add the source dirs to the example in my root elm-package.json the loader works with source files.
e.g. https://github.com/sporto/elm-select/blob/webpack-loader-cwd/elm-package.json
But this is not a good option as I would be adding example directories to the published library.

Thanks for the help

from elm-webpack-loader.

eeue56 avatar eeue56 commented on July 30, 2024

@sporto not following the problem. Can you give me a tl;dr form of the problem?

from elm-webpack-loader.

sporto avatar sporto commented on July 30, 2024

@eeue56

I have a project structure like:

src
elm-package.json
example
	src
	elm-package.json
	webpack.config.js

I run webpack from example.

When not using cwd the loader cannot pickup changes in ../src/.

Proposed solution is to use cwd.
But when using cwd set to the root the loader uses the incorrect elm-package.json

So the problem is that the loader doesn't watch the specified dirs in elm-package.json. cwd is a workaround that has also an issue.

Thanks

from elm-webpack-loader.

eeue56 avatar eeue56 commented on July 30, 2024

@sporto see if 4.3.0 fixes it for you

from elm-webpack-loader.

sporto avatar sporto commented on July 30, 2024

Unfortunately it didn't . I still need to restart the webpack dev server

from elm-webpack-loader.

sentience avatar sentience commented on July 30, 2024

@sporto node-elm-compiler was just updated to 4.3.1 with an enhancement I added to crawl dependencies across multiple source directories. If you reinstall/update elm-webpack-loader, it should grab this updated version of the dependency, and hopefully fix your problem.

from elm-webpack-loader.

kuon avatar kuon commented on July 30, 2024

I also have an issue with the loader picking changes only to the Main.elm file and not the dependencies.

I noticed that ^4.2.1 is the version definition of node-elm-compiler enforced by package.json.

My setup is a bit different, my webpack entry point is index.js and in index.js I require Main.elm.

from elm-webpack-loader.

kuon avatar kuon commented on July 30, 2024

Actually, my issue was that forceWatch was required with webpack-dev-server. Maybe this should be documented?

from elm-webpack-loader.

eeue56 avatar eeue56 commented on July 30, 2024

closing this issue: please reopen if you run into it again in the future, with a reproducable example if possible! I haven't seen this in the wild since 4.3.1.

from elm-webpack-loader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.