You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently I can run npm run watch in the individual packages in the monorepo, but a change in one project isn't reflected in the other packages that depend on that project. For example, if I run npm run watch for packages/element, and also run npm run watch for packages/pc, when I make changes to the source code in packages/element, this does not trigger packages/pc to rebuild. Is there any way of achieving this currently?
It seems like father only watches the directory of the configured entry file, which is why this doesn't work. I notice each package also has a webpack.dev.config.js although these don't seem to be referenced from anywhere. Using webpack would make this a bit easier because by default it watches all the files from the import graph starting from the entrypoint.
Something like this does work:
# initial repo setup
yarn install
yarn bootstrap
yarn build:all
# watch and rebuild all individual packages
yarn lerna run --parallel watch
# then in another shell...
cd packages/G6
yarn run webpack --config webpack.dev.config.js --mode development
Then father will rebuild any of the packages when their source TS files change, and webpack will detect the newly built files from the packages that it depends on and trigger its own rebuild. It works but it's a bit cumbersome and I don't think the father build outputs sourcemaps which isn't ideal.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently I can run
npm run watch
in the individual packages in the monorepo, but a change in one project isn't reflected in the other packages that depend on that project. For example, if I runnpm run watch
forpackages/element
, and also runnpm run watch
forpackages/pc
, when I make changes to the source code inpackages/element
, this does not triggerpackages/pc
to rebuild. Is there any way of achieving this currently?It seems like
father
only watches the directory of the configuredentry
file, which is why this doesn't work. I notice each package also has awebpack.dev.config.js
although these don't seem to be referenced from anywhere. Using webpack would make this a bit easier because by default it watches all the files from the import graph starting from the entrypoint.Something like this does work:
Then
father
will rebuild any of the packages when their source TS files change, and webpack will detect the newly built files from the packages that it depends on and trigger its own rebuild. It works but it's a bit cumbersome and I don't think thefather
build outputs sourcemaps which isn't ideal.Beta Was this translation helpful? Give feedback.
All reactions