Uncaught SyntaxError when using Composition API with Pug: Missing type in import statement #12542
Labels
🔨 p3-minor-bug
Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.
has workaround
A workaround has been found to avoid the problem
Vue version
3.4.27
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-pu2hgbvs?file=src%2Fcomponents%2FHelloWorldSetupPug.vue&terminal=dev
or
https://codesandbox.io/p/devbox/fast-cookies-75hgkn?file=%2Fsrc%2Fcomponents%2FHelloWorldSetupPug.vue%3A3%2C8&workspaceId=ws_QsAMR8rV8TbYxEA1u1WzFz
Steps to reproduce
HelloWorld
,HelloWorldSetup
,HelloWorldPug
, andHelloWorldSetupPug
.Setup
indicates the use of the Composition API.Pug
indicates the use of Pug.pnpm install && pnpm dev
.HelloWorldSetupPug
triggers the error, while the other files (HelloWorld
,HelloWorldSetup
, andHelloWorldPug
) work fine.import { MyType } from "../utils/myUtils"
inHelloWorldSetupPug
.type
to the import statement (import type { MyType } from "../utils/myUtils"
) resolves the issue.What is expected?
All files, including
HelloWorldSetupPug
, should work without requiringtype
in theimport
statement if it is consistent with the behavior of the other files.What is actually happening?
Only
HelloWorldSetupPug
throws the following error in the browser:This issue is resolved by adding
type
to the import statement.System Info
Any additional comments?
HelloWorld
,HelloWorldSetup
, andHelloWorldPug
) work fine without addingtype
in theimport
statement.The text was updated successfully, but these errors were encountered: