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

[vite] Internal server error: Cannot overwrite across a split point #14

Closed
Dids opened this issue Jul 15, 2022 · 6 comments
Closed

[vite] Internal server error: Cannot overwrite across a split point #14

Dids opened this issue Jul 15, 2022 · 6 comments
Labels
help wanted Extra attention is needed wontfix This will not be worked on

Comments

@Dids
Copy link

Dids commented Jul 15, 2022

Using Vue 3 + SFC + TypeScript + Vite, and I consistently get this error whenever I try to use either the now "deprecated" vue-class-component or this library (vue-facing-decorator), which I've been using now, in hopes of fixing this.
I'm using pretty much latest stable versions of everything, but have tried rolling back several versions, except it makes no difference.
Additionally, I'm on macOS + M1 Pro (arm64/aarc64), just in case that makes a difference.

So far I've been entirely unable to track down why this happens, and it only seems to happen in larger components, while smaller components seem to be fine, but I'll keep digging, removing code piece by piece, until it stops and see if I can track it down.
In the meantime, I just wanted to ask around to see if anyone else has ran into this, as Google is not returning any useful results for this particular error.

Here's the full error:

[vite] Internal server error: Cannot overwrite across a split point
  Plugin: vite:vue
  File: /Users/dids/Work/Other/presentor-backend-frontend/src/components/TableV2/TableV2.vue
      at MagicString.overwrite (/Users/dids/Work/Other/presentor-backend-frontend/node_modules/magic-string/dist/magic-string.cjs.js:693:11)
      at /Users/dids/Work/Other/presentor-backend-frontend/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:3355:15
      at Array.forEach (<anonymous>)
      at Object.rewriteDefault (/Users/dids/Work/Other/presentor-backend-frontend/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js:3353:9)
      at genScriptCode (/Users/dids/Work/Other/presentor-backend-frontend/node_modules/@vitejs/plugin-vue/dist/index.cjs:2231:37)
      at transformMain (/Users/dids/Work/Other/presentor-backend-frontend/node_modules/@vitejs/plugin-vue/dist/index.cjs:2111:54)
      at TransformContext.transform (/Users/dids/Work/Other/presentor-backend-frontend/node_modules/@vitejs/plugin-vue/dist/index.cjs:2499:16)
      at Object.transform (file:///Users/dids/Work/Other/presentor-backend-frontend/node_modules/vite/dist/node/chunks/dep-561c5231.js:35252:53)
      at async loadAndTransform (file:///Users/dids/Work/Other/presentor-backend-frontend/node_modules/vite/dist/node/chunks/dep-561c5231.js:39740:29)
@ruojianll
Copy link
Contributor

ruojianll commented Jul 15, 2022

So far, I don't suffer the error and know nothing about it. But after reading the error stack, I think vue use magic-string to compile SFC file and throw the error during compiling time. So everywhere of the whole SFC file content may cause the error.

If everything is fine while you don't using any decorator libraries, it should happened in type script code section. Try to separate ts code to a single file and import it, see if the error be fixed.

// MyComponent.class.ts
...
@Component
export default MyComponent extends Vue{
}

//MyComponent.vue
<template></template>
<style></style>
<script lang="ts">
import MyComponent from "./MyComponent.class.ts"
export default MyComponent
</script>

Due to the component class code is loaded from a ts file, SFC compiler may skip it.

@ruojianll
Copy link
Contributor

I advice you to contribute the issue to @vue/compiler-sfc team.

@ruojianll ruojianll added help wanted Extra attention is needed wontfix This will not be worked on labels Jul 15, 2022
@Dids
Copy link
Author

Dids commented Jul 15, 2022

Thank you, I had a feeling but wanted to confirm first. :)

I'll close this issue and see if I can dig up more information and/or a reproducible example and post a new issue to the Vue/SFC repository.

@Dids Dids closed this as completed Jul 15, 2022
@ruojianll
Copy link
Contributor

ruojianll commented Jul 16, 2022

If you create an issue about this, please @ me. thank you.

@Dids
Copy link
Author

Dids commented Jul 21, 2022

@ruojianll I didn't yet have a chance to submit an issue, but someone else did!

Here's the issue:
vuejs/core#6318

And the same person also provided a PR to fix it here:
vuejs/core#6320

@ruojianll
Copy link
Contributor

ruojianll commented Jul 22, 2022

@Dids Congratulations! It seems to work fine on all decorator repos. But why other people(and me ) didn't suffer your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants