'Smart way to recompile create-react-app when a dependency changes

I’m using create-react-app with inside a package (my-package) that i developed. My-package is bundled with webpack.

During heavy duty test loops i often change my-package and i re-install it locally in the react-app with npm i —save ../my-package, unfortunately this operation is slow and does not trigger a recompile action by the react-app when i’m in npm start mode.

It would be nice if i could set webpack —watch in my-package and somehow have the bundle served to the react-app + a recompile trigger.

Is there a way to achieve this? Thanks.



Solution 1:[1]

I've noticed that when a dependency is added via the file: attribute, CRA will ignore changes. However, using link: instead, CRA starts listening for changes as well.

"dependencies": {
  "package-name": "link:../relative/path/to/your/package"
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tanckom