Comments (10)
@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.
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.
@sporto not following the problem. Can you give me a tl;dr form of the problem?
from elm-webpack-loader.
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.
@sporto see if 4.3.0 fixes it for you
from elm-webpack-loader.
Unfortunately it didn't . I still need to restart the webpack dev server
from elm-webpack-loader.
@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.
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.
Actually, my issue was that forceWatch
was required with webpack-dev-server. Maybe this should be documented?
from elm-webpack-loader.
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)
- Peer dependency issue for elm 0.19.1-1 HOT 8
- Path with a space fails compilation
- The old version of yargs being used in the dependencies has vulnerabilities
- Replacing strings in generated output
- Version 7.0.1/8.0.0 can cause memory problems on Windows HOT 1
- Version 7.01 doesn't observe source code changes anymore HOT 14
- `npm install --save elm-webpack-loader` fails HOT 1
- Webpack 5 error in the browser HOT 1
- This loader should not expect `--watch` for the dev server HOT 9
- Error: Cannot find module 'temp'
- Do not see elm compiler erros in browser console anymore HOT 2
- Problem with the NPM package - 403 Forbidden from dl.bintray.com HOT 1
- elm-webpack-loader appears to be trying to use file without main as an entrypoint HOT 3
- Compilation causing cache errors with version 7 and 8 HOT 1
- 8.0.0 compiles all the Elm files on a single file change HOT 4
- Usage with webpack5's new `cache.type = 'filesystem'` seems broken across builds.
- Elm errors don’t show up on overlay anymore HOT 1
- Facilitate applying patches
- CVE-2022-37601 (update loader-utils to v3)
- quick usage help question - `Compiler process exited with error Compilation failed` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elm-webpack-loader.