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 reproduction includes four files: HelloWorld, HelloWorldSetup, HelloWorldPug, and HelloWorldSetupPug.
Setup indicates the use of the Composition API.
Pug indicates the use of Pug.
Run the reproduction in a browser with pnpm install && pnpm dev.
Only HelloWorldSetupPug triggers the error, while the other files (HelloWorld, HelloWorldSetup, and HelloWorldPug) work fine.
The error appears when using import { MyType } from "../utils/myUtils" in HelloWorldSetupPug.
Adding type to the import statement (import type { MyType } from "../utils/myUtils") resolves the issue.
What is expected?
All files, including HelloWorldSetupPug, should work without requiring type in the import 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:
Uncaught SyntaxError: The requested module '/src/utils/myUtils.ts?t=1734061016288' does not provide an export named 'MyType'
This issue is resolved by adding type to the import statement.
if a variable is used in the template, we will return it in non-inline mode. However, if the template's lang is pug, isUsedInTemplate will be true without checking if it is really used in template. This result in MyType being returned as a variable to the template with
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: