8000 make/webpack: dev builds resolve the lock with the node modules, so the bundle that depends on it has a rule that makes it by aivazis · Pull Request #60 · aivazis/mm · GitHub
[go: up one dir, main page]

Skip to content

make/webpack: dev builds resolve the lock with the node modules, so the bundle that depends on it has a rule that makes it - #60

Merged
aivazis merged 1 commit into
mainfrom
webpack-lock
Sep 28, 2026
Merged

aivazis merged 1 commit into
mainfrom
webpack-lock

Conversation

@aivazis
@aivazis aivazis commented Sep 28, 2026
Copy link
Copy Markdown
Owner

In dev mode, the rule that runs npm i now also declares the staged package-lock.json as one of its outputs, so the bundle's dependency on the lock has a rule that makes it.

The regression

#59 (04b724e) made the staged package-lock.json a prerequisite of the webpack bundle, so that a change to the resolved dependencies rebuilds it. The release modes install through webpack.npm.install.locked, which has a rule that copies the committed lock into the staging area. Dev mode installs through webpack.npm.install.fresh, where the lock is written by npm i as a side effect and no rule names it. A staging area that already held a lock from an earlier install treated it as a source file, so the gap stayed hidden. In a fresh build context the lock does not exist yet, and every dev build of a webpack bundle stops with:

make: *** No rule to make target '.../<pack>.ux/package-lock.json', needed by '.../<pack>.ux/build/<pack>.html'.  Stop.

The change

webpack.npm.install.fresh is now a grouped target, so a single npm i makes both the node modules and the lock:

$(modules) $(npm_lock) &: $(npm_config) | $(staging.prefix)

The recipe touches both outputs, as it already did for the modules, because npm i leaves them alone when there is nothing to install. When npm i resolves the dependency tree again, the bundle is rebuilt. The locked install is unchanged.

Verification

In qed, in dev mode, from a fresh build context: the full build succeeds, and a second mm right after runs neither npm i nor webpack.

…he bundle that depends on it has a rule that makes it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0