-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yalc doesn't work in a vite project #239
Comments
I'm able to get yalc to work with vite however, for live re-load changes I have not found a solution for that. 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. |
这是来自QQ邮箱的假期自动回复邮件。你好,您的邮件我已经收到,会尽快给您回复,谢谢!
|
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
On the library side, I also use nodemon to watch for changes, when it detects a change it builds the library runs It isn't an ideal solution because it takes time for the dev server to restart, especially using the |
这是来自QQ邮箱的假期自动回复邮件。你好,您的邮件我已经收到,会尽快给您回复,谢谢!
|
my existing yalc installation w/ vite stopped working. |
这是来自QQ邮箱的假期自动回复邮件。你好,您的邮件我已经收到,会尽快给您回复,谢谢!
|
Yalc does work! I ran into the same issue and ended up finding a solution. I currently run The trick to this is in the export default defineConfig(({ mode }) => {
return {
optimizeDeps: {
entries: ['your-package'], // This is the line!
}
}
}); A note on this is that you should not do this for production! I'd recommend using export default defineConfig(({ mode }) => {
return {
optimizeDeps: {
entries: mode === 'development' ? ['your-package'] : undefined, // This is the line!
}
}
}); Another viable option is to use environment variables in the command line to determine if you're expecting yalc stuff to change or not. Something along these lines:
// vite.config.ts
export default defineConfig(() => {
return {
optimizeDeps: {
entries: process.env.YALC ? ['your-package'] : undefined, // This is the line!
}
}
}); |
这是来自QQ邮箱的假期自动回复邮件。你好,您的邮件我已经收到,会尽快给您回复,谢谢!
|
No description provided.
The text was updated successfully, but these errors were encountered: