question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

All elm apps rebuild on each change

See original GitHub issue

This might be a peculiarity of my setup but I have 4 separate elm apps being built by webpack and when ever I make a change all 4 rebuild. Even when the change is to a file that is only used by one of them.

The rebuilding can be quite quick for 3 of the 4 apps but it is still slows down the experience.

I see output like this on a typical file change:

[1354] ./node_modules/moment/locale ^\.\/.*$ 2.86 kB {27} [optional] [built]
    + 1495 hidden modules
 46% building modules 6/10 modules 4 active ...erver/apps/business/src/Locations.elmStarted compiling Elm..
 52% building modules 7/10 modules 3 active ...erver/apps/business/src/Locations.elmStarted compiling Elm..
 57% building modules 8/10 modules 2 active ...erver/apps/business/src/Locations.elmStarted compiling Elm..
 64% building modules 9/10 modules 1 active ...erver/apps/business/src/Locations.elmStarted compiling Elm..
 94% asset optimization

Though interestingly, src/Locations.elm is only one of the 4 elm entry files. Not sure why that name is printed out each time.

My set up is that I have a single folder (server/apps/business) which has a elm-package.json and 4 typescript files. Each of those typescript files requires a different .elm file from the src subdirectory in server/apps/business.

My webpack elm rule looks like:

                {
                    test: /\.elm$/,
                    exclude: [/elm-stuff/, /node_modules/],
                    use: [
                        'elm-css-modules-loader',
                        {
                            loader: 'elm-webpack-loader',
                            options: {
                                debug,
                                cwd: path.join(__dirname, '..', 'server', 'apps', 'business'),
                                pathToMake
                            }
                        }
                    ]
                },

I’ve tried looking at the code. I get the feeling that it is watching all *.elm files and rebuilds everything if any of them changes rather than following imports from each entry .elm file. Understandable if that is the case but I wanted to check in case the behaviour I’m seeing is avoidable with some configuration changes.

Thanks for the project. It has made it much easier to add elm into my stack at work.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

3reactions
szubtsovskiycommented, Oct 1, 2019

I’ve run into the same issue and finally got it resolved by removing cwd option from elm-webpack-loader. Seems working fine though I don’t know if it was a time bomb as this option is recommended.

2reactions
gavin667commented, Oct 3, 2019

We also just managed to get this working by removing the cwd option as well.

We did run into an issue were some files were not compiling when file dependencies changed but this was due to some files not having the proper namespaced module name in the main elm file that was initialised in the Javascript. These files shouldn’t have been compiling from the start because of the module name but because the cwd adds all of these file as dependencies of each other they compiled regardless.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Design of Large Elm apps - Google Groups
With this approach you only have to deal with one update happening, you can separate code into different modules, but the update function...
Read more >
Reusing a non-published module across multiple apps
I am likely going to add a build-all script that calls all the other builds that can be used to rebuild everything and...
Read more >
Updating the Catalog Indexes - Oracle Help Center
Use the Rebuild Indexes component to run the processes that update the catalog index. Enterprise Learning Management uses the catalog index to perform ......
Read more >
Upgrading the server configuration on z/OS - IBM
This topic describes the steps required to upgrade a server for IBM Engineering Lifecycle Management (ELM) applications that use Db2 for z/OS.
Read more >
Building and Testing Web Applications with Elm - Semaphore CI
When refactoring, can you be sure that you've changed all instances of the affected code and that everything will work afterwards? Can you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found