vitejs / vite-plugin-vue2

Vite plugin for Vue 2.7
MIT License
551 stars 47 forks source link

Named exports inside SFC fails #25

Closed alexmarchant closed 1 year ago

alexmarchant commented 2 years ago
9:06:40 PM [vite] Internal server error: Cannot overwrite across a split point
  Plugin: vite:vue2
  File: /Users/alex/Developer/feedback-loop/the-ocean/reef/src/components/NoUISlider.vue
      at MagicString.overwrite (/Users/alex/Developer/feedback-loop/the-ocean/reef/node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.js:2362:11)
      at /Users/alex/Developer/feedback-loop/the-ocean/reef/node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.js:8182:15
      at Array.forEach (<anonymous>)
      at Object.rewriteDefault (/Users/alex/Developer/feedback-loop/the-ocean/reef/node_modules/vue/node_modules/@vue/compiler-sfc/dist/compiler-sfc.js:8180:9)
      at genScriptCode (/Users/alex/Developer/feedback-loop/the-ocean/reef/node_modules/@vitejs/plugin-vue2/dist/index.cjs:2993:37)
      at transformMain (/Users/alex/Developer/feedback-loop/the-ocean/reef/node_modules/@vitejs/plugin-vue2/dist/index.cjs:2911:54)
      at TransformContext.transform (/Users/alex/Developer/feedback-loop/the-ocean/reef/node_modules/@vitejs/plugin-vue2/dist/index.cjs:3248:16)
      at Object.transform (file:///Users/alex/Developer/feedback-loop/the-ocean/reef/node_modules/vite/dist/node/chunks/dep-561c5231.js:35252:53)
      at async loadAndTransform (file:///Users/alex/Developer/feedback-loop/the-ocean/reef/node_modules/vite/dist/node/chunks/dep-561c5231.js:39740:29)

This component in question NoUISlider.vue has a named export

export type NoUISliderOptions = Partial<noUiSlider.Options>

export default class NoUISlider extends Vue { ... }

As soon as i remove the export prefix vite has no issues with it.