-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
fix: handle local and module scripts separately #5464
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize this could technically happen in .vue
files as well, when a user uses variables with the same name in both normal <script>
and <script setup>
(although this seems less common than in Svelte? I personally have never seen anyone do this)
So I think some level of hard-coding for this is unavoidable (before the refactor), but on a high level there would be two code paths:
- "Module" context script tags:
<script>
in vue, and<script context="moule">
in svelte. - "Local" context script tags:
<script setup>
in vue, and<script>
in svelte.
We should detect these two paths upfront and then apply the new virtual module logic to (2). This would allow us to limit the framework-specific part to the script context detection phase and make the virtual module handling framework agnostic.
6b8f8b5
to
1ef2e76
Compare
1ef2e76
to
12bea5b
Compare
I'm not sure I understood 100% of that comment, but I did add support for |
Description
Treat Svelte's
<script>
and<script context="module">
as separate contexts during import scanFixes #5446
Additional context
This is a very annoying issue that causes prebundling to fail so that the server won't start if you use variables with the same name in different script contexts, which is a very common thing to do in Svelte
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).