Skip to content
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

feat: restart server when svelte config file changes (fixes #63) #72

Merged
merged 13 commits into from
Jun 30, 2021

Conversation

dominikg
Copy link
Member

the dynamic import with ?t= param makes the workaround even more ugly but otherwise a cache might return the old config instead of the changed one.

Tests needed, esp. to ensure that output changes due to different compiler settings are loaded in the browser.

Idea: test virtual css module exists, then switch emitCss off, test that page reloads and virtual module no longer exists.

@bluwy
Copy link
Member

bluwy commented Jun 26, 2021

the dynamic import with ?t= param makes the workaround even more ugly but otherwise a cache might return the old config instead of the changed one.

Looks like Vite is doing something similar too, so I don't think it's all too ugly.

Really like the changes here, looks cleaner than vite-plugin-restart's implementation. Gonna test this locally now.

@dominikg
Copy link
Member Author

ahhh, great. was wondering about how to clear require cache https://github.com/vitejs/vite/blob/7362e6e9a7a0f0177b467f1cf80552acf22c46a0/packages/vite/src/node/config.ts#L772

the mjs detection might be worth using too

@dominikg
Copy link
Member Author

finally! the refactored e2e setup means vite is no longer run inline during tests but instead via execution of package.json dev or build + preview scripts. (with the exception of vite-ssr where the custom setup still needs conversion). Because the project setup no longer relies on jest to start vite, we can also use esm projects for e2e tests 🎉

@dominikg dominikg merged commit 5100376 into main Jun 30, 2021
@dominikg dominikg deleted the feat/watch-svelte-config branch June 30, 2021 10:00
@github-actions github-actions bot mentioned this pull request Jun 30, 2021
@github-actions github-actions bot mentioned this pull request Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants