Skip to content

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

@xiangnanscu

Description

@xiangnanscu

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

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy