unplugin / unplugin-auto-import

Auto import APIs on-demand for Vite, Webpack and Rollup
MIT License
3.29k stars 198 forks source link

syntax export * as utils from "@/lib/utils.mjs" doesn't work #377

Open xiangnanscu opened 1 year ago

xiangnanscu commented 1 year ago

Describe the bug

say I've a file @/globals/index.mjs whose content is:

export { Model } from "@/lib/model.mjs";
export * as utils from "@/lib/utils.mjs";

utils can't be auto imported because when I use code like console.log({Model, utils}) will get error ReferenceError: utils is not defined.

But this works:

export { Model } from "@/lib/model.mjs";
import * as utils from "@/lib/utils.mjs";
export { utils };

Is this normal?

Reproduction

https://github.com/antfu/unplugin-auto-import

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 AMD Ryzen 5 5600G with Radeon Graphics
    Memory: 22.65 GB / 39.30 GB
  Binaries:
    Node: 18.12.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD

Used Package Manager

npm

Validations

xiaoxiangmoe commented 1 year ago

Can you provide a minimal reproducible example to help us find some clue?