code.pyret.org icon indicating copy to clipboard operation
code.pyret.org copied to clipboard

modal-prompt.js changes don't get into build

Open asolove opened this issue 1 year ago • 3 comments

Problem

If you have an existing build, make changes to modal-prompt.js, and then run npm run build, in the general case the modal code changes will not be in the resulting build. It appears you have to make changes to some other file (I'm not sure exactly which will work) or completely delete the current build and build from scratch, to ingest the changes.

I would like to figure out a fix because I have a bunch of modal changes I want to finish up and the current dev cycle is too slow and painful to get through them.

Research:

  • Find a quick way to tell whether changes get built (without having to load in browser)
  • Find which files trigger the changes to get into a build and which don't
  • Try to track through the Makefile to understand why.

asolove avatar Jan 21 '24 14:01 asolove

Thanks for writing this down clearly.

There are a few workflows that have existed for a while where I have to write touch src/web/js/beforePyret.js (which is the main webpack entrypoint) before rebuilds trigger. It happens sometimes for the dev Pyret compiler/runtime, too, leading to “Pyret failed to load” until touch and rebuild.

I have tended to give up before figuring out why.

jpolitz avatar Jan 23 '24 17:01 jpolitz

Ah! I see. So then I think the relevant chunk is this target in the Makefile:

build/web/js/beforePyret.js: src/web/js/beforePyret.js
	npx webpack

Which means that as far as make knows, it should only re-run webpack when that one file changes. I think that target should include dependencies on every file that gets included by the webpack config, so that it knows to re-run webpack if any of them change.

I can play around with getting the list exactly right.

asolove avatar Jan 24 '24 01:01 asolove

Oh that sure sounds like a reasonable culprit! Please do find the right dependency list if you can; I got bitten by this today and forgot how annoying it was to have to guess which file to touch to make the rebuild go through...

blerner avatar Apr 30 '24 20:04 blerner