Open xisenbao opened 3 months ago
这是来自QQ邮箱的假期自动回复邮件。你好,您的邮件我已经收到,会尽快给您回复,谢谢!
I'm able to get yalc to work with vite however, for live re-load changes I have not found a solution for that. I am using React 18 and my current process is
from npm package:
npm run build yalc publish --push yalc push --sig
then from my React 18 application:
yalc add @myorg/components npm run build
I have to do those steps everytime I make an update in my npm package to reflect the change in my React application. I have tried using the
--replace
flag but it still requires the same commands to reflect new changes. Does anyone have any solution for this on how to reflect automatic updates with vite? It would make development a whole lot smoother and enjoyable for us. Thanks!
I use yalc in a React vite project and experienced similar issues. The problem is with vites dependency optimization, it doesn't know to reload the dependency everytime it changes. The best solution I've found is to have nodemon watch the .yalc folder and have it restart the dev server with the --force flag to force it to reload the dependencies. This is what my start script looks like
nodemon --signal SIGKILL --watch .yalc --exec npx yarn start --force --no-open
On the library side, I also use nodemon to watch for changes, when it detects a change it builds the library runs yalc push
.
It isn't an ideal solution because it takes time for the dev server to restart, especially using the --force
flag, but it has worked pretty consistently for the past year or so and all the builds happen automatically which is nice. If you (or anyone else) has come up with a better solution, please let me know
这是来自QQ邮箱的假期自动回复邮件。你好,您的邮件我已经收到,会尽快给您回复,谢谢!
I'm able to get yalc to work with vite however, for live re-load changes I have not found a solution for that. I am using React 18 and my current process is
from npm package:
then from my React 18 application:
I have to do those steps everytime I make an update in my npm package to reflect the change in my React application. I have tried using the
--replace
flag but it still requires the same commands to reflect new changes. Does anyone have any solution for this on how to reflect automatic updates with vite? It would make development a whole lot smoother and enjoyable for us. Thanks!