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

separate es modules for <script context="module"> and <script> during dev / hmr #136

Closed
dominikg opened this issue Aug 7, 2021 · 3 comments
Labels
enhancement New feature or request hmr

Comments

@dominikg
Copy link
Member

dominikg commented Aug 7, 2021

Describe the problem

Current implementation in svelte-hmr self-accepts updates to Component.svelte, which can cause broken references for exports of context=module scripts. see #134

Describe the proposed solution

Instead of returning 1 es-module for Component.svelte js, return a facade wrapping 2 virtual modules, allowing for separate hmr updates and properly propagating updates of context=module

Alternatives considered

Use acceptNamedExports: false option of svelte-hmr, letting updates bubble and live with extra reloads

Importance

would make my life easier

@dominikg dominikg added enhancement New feature or request triage Awaiting triage by a project member hmr and removed triage Awaiting triage by a project member labels Aug 7, 2021
@dominikg
Copy link
Member Author

dominikg commented Aug 7, 2021

This is a draft to collect information and lay out a plan what has to be done and document experiments around it.
If you have ideas or opinions on this topic, please share.

@bluwy
Copy link
Member

bluwy commented Aug 8, 2021

Note: This is also discussed in a discord thread.

@dominikg
Copy link
Member Author

dominikg commented Oct 2, 2022

since the addition of partial accept to vite and svelte-hmr 0.15 + vite-plugin-svelte 1.0.6 supporting it, the change described here would add little to no additional benefit and would add significant complexity.

We might revisit it later if other needs present themselves but for now the current solution does allow for granular updates even with context=module.

@dominikg dominikg closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hmr
Projects
None yet
Development

No branches or pull requests

2 participants