Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous import "..." has multiple matching exports #16211

Closed
7 tasks done
maantje opened this issue Mar 20, 2024 · 1 comment · Fixed by #16305
Closed
7 tasks done

Ambiguous import "..." has multiple matching exports #16211

maantje opened this issue Mar 20, 2024 · 1 comment · Fixed by #16305
Labels
feat: deps optimizer Esbuild Dependencies Optimization p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@maantje
Copy link

maantje commented Mar 20, 2024

Describe the bug

I have a component (A) with a default export of the component and a named export in the same file. This component also contains an import.meta.glob and imports a directory (B).

Subsequently, Component A is imported into another component, C, which also contains an import.meta.glob of the same directory.

This results in:

Error:   Failed to scan for dependencies from entries:
  /home/projects/vue3-vite-starter-w2qd5j/index.html

  ✘ [ERROR] Ambiguous import "something" has multiple matching exports

    script:/home/projects/vue3-vite-starter-w2qd5j/src/App.vue?id=0:2:21:
      2 │ import HelloWorld, { something } from '@/components/HelloWorld.vue'
        ╵                      ~~~~~~~~~

  One matching export is here:

    script:/home/projects/vue3-vite-starter-w2qd5j/src/components/HelloWorld.vue?id=0:19:13:
      19 │ export const something = 'something'
         ╵              ~~~~~~~~~

  Another matching export is here:

    script:/home/projects/vue3-vite-starter-w2qd5j/src/components/HelloWorld.vue?id=1:19:13:
      19 │ export const something = 'something'

This issue arises only when the directory imported with import.meta.glob contains multiple files.

Overview:

Untitled-2024-01-25-1600

Reproduction

https://stackblitz.com/edit/vue3-vite-starter-w2qd5j

Steps to reproduce

Run yarn dev --force

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    @vitejs/plugin-vue: ^5.0.4 => 5.0.4 
    vite: ^5.1.5 => 5.1.6

Used Package Manager

yarn

Logs

No response

Validations

Copy link

stackblitz bot commented Mar 20, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sapphi-red sapphi-red added p3-minor-bug An edge case that only affects very specific usage (priority) feat: deps optimizer Esbuild Dependencies Optimization labels Mar 29, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Apr 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: deps optimizer Esbuild Dependencies Optimization p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants