You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error is presented by Vite immediately upon opening the project.
If you comment out the TestComponent and uncomment the TestComponentLocal there is no error.
This same error occurs when trying to build the project as well.
What is expected?
In TestComponent, the type QSelectProps is being imported from the "quasar" library and is being used as the type in defineProps.
In TestComponentLocal, that exact type QSelectProps has been copy/pasted into a local .ts file. So, the only difference is the location of the type definition.
TestComponentLocal works and I would expect TestComponent to work in the same way.
What is actually happening?
TestComponent fails to render with this error from the vite dev server.
Error in error handler:
Error: offset is longer than source length! offset 416615 > length 349
at numberToPos (file://file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:12128:15)
at formatError (file://file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:42679:35)
at TransformContext.error (file://file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:42657:19)
at Object.transform (file://file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:42938:25)
at async loadAndTransform (file://file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:53401:29)
Missing initializer in const declaration. (14207:45)
Error in error handler:
Error: offset is longer than source length! offset 416615 > length 349
at numberToPos (file://file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:12128:15)
at formatError (file://file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:42679:35)
at TransformContext.error (file://file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:42657:19)
at Object.transform (file://file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:42938:25)
at async loadAndTransform (file://file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:53401:29)
11:50:27 AM [vite] Internal server error: Missing initializer in const declaration. (14207:45)
Plugin: vite:vue
File: /home/projects/vue3-vite-typescript-starter-tk9ebx/src/components/TestComponent.vue:14207:45
at instantiate (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:653:32)
at constructor (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:946:12)
at TypeScriptParserMixin.raise (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:3270:19)
at TypeScriptParserMixin.parseVar (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:13201:16)
at TypeScriptParserMixin.parseVarStatement (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:13032:10)
at TypeScriptParserMixin.parseVarStatement (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:9364:31)
at TypeScriptParserMixin.parseStatementContent (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:12629:23)
at TypeScriptParserMixin.parseStatementContent (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:9398:18)
at TypeScriptParserMixin.parseStatementLike (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:12549:17)
at TypeScriptParserMixin.parseStatementListItem (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:12529:17)
I also get this error when attempting to build the project.
[vite:vue] Missing initializer in const declaration. (14207:45)
file: /home/projects/vue3-vite-typescript-starter-tk9ebx/src/components/TestComponent.vue:14207:45
error during build:
SyntaxError: Missing initializer in const declaration. (14207:45)
at instantiate (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:653:32)
at constructor (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:946:12)
at TypeScriptParserMixin.raise (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:3270:19)
at TypeScriptParserMixin.parseVar (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:13201:16)
at TypeScriptParserMixin.parseVarStatement (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:13032:10)
at TypeScriptParserMixin.parseVarStatement (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:9364:31)
at TypeScriptParserMixin.parseStatementContent (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:12629:23)
at TypeScriptParserMixin.parseStatementContent (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:9398:18)
at TypeScriptParserMixin.parseStatementLike (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:12549:17)
at TypeScriptParserMixin.parseStatementListItem (file:///home/projects/vue3-vite-typescript-starter-tk9ebx/node_modules/@babel/parser/lib/index.js:12529:17)
I'm trying to wrap a component library component in a custom component, and using the library's prop types to define my customer component's properties.
This currently works if I copy out the props type into a file in the local repository, but not by importing it directly from node_modules.
The text was updated successfully, but these errors were encountered:
Vue version
3.3
Link to minimal reproduction
https://stackblitz.com/edit/vue3-vite-typescript-starter-tk9ebx?file=src/App.vue
Steps to reproduce
The error is presented by Vite immediately upon opening the project.
If you comment out the
TestComponent
and uncomment theTestComponentLocal
there is no error.This same error occurs when trying to build the project as well.
What is expected?
In
TestComponent
, the typeQSelectProps
is being imported from the "quasar" library and is being used as the type indefineProps
.In
TestComponentLocal
, that exact typeQSelectProps
has been copy/pasted into a local.ts
file. So, the only difference is the location of the type definition.TestComponentLocal
works and I would expectTestComponent
to work in the same way.What is actually happening?
TestComponent
fails to render with this error from the vite dev server.I also get this error when attempting to build the project.
System Info
Any additional comments?
I'm trying to wrap a component library component in a custom component, and using the library's prop types to define my customer component's properties.
This currently works if I copy out the props type into a file in the local repository, but not by importing it directly from node_modules.
The text was updated successfully, but these errors were encountered: