Webpack doesn't pick up local node_modules updates

Viewed 226

I have a package A that depends on package B. I am using yalc to update B and publish changes locally so that A can pick up these changes.

I can see that the changes are copied into A's node_modules folder, however webpack doesn't seem to pick them up. When running A in a dev server, I still see the old code. Restarting the dev server doesn't help. Even yarn install --check-files doesn't help. The only thing that helps is nuking the whole node_modules and reinstalling.

Project A was creates with create-react-app

package.json has the following:

dependencies: {
...
@company_name/project_name: "file:.yalc@company_name/project_name"
... }

I am using yarn 1.22

1 Answers

tl;dr

yalc push --sig

Explanation

Webpack caches, aggressively, modules based on the package.json version

Changing the version number, rebuilding and running yalc push, which does trigger an immediate rebuild in webpack-dev-server.

yalc push and yalc publish support a --sig option, which adds the current build signature to the deployed packages' version numbers.

Related