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

Vite unable to resolve wildcard exports on >=4.0.4 #12284

Closed
7 tasks done
bnussman-akamai opened this issue Mar 3, 2023 · 3 comments · Fixed by #12314
Closed
7 tasks done

Vite unable to resolve wildcard exports on >=4.0.4 #12284

bnussman-akamai opened this issue Mar 3, 2023 · 3 comments · Fixed by #12314
Labels
bug: upstream Bug in a dependency of Vite regression The issue only appears after a new release

Comments

@bnussman-akamai
Copy link

bnussman-akamai commented Mar 3, 2023

Describe the bug

A package that exports dependencies like shown below are unable to be resolved when importing with with the name @linode/api-v4/lib/account. It is my understanding that the import @linode/api-v4/lib/account should be handled by the "./lib/*" export, but it is not.

  "exports": {
    ".": {
      "import": "./lib/index.js",
      "require": "./lib/index.cjs"
    },
    "./lib": {
      "import": "./lib/index.js",
      "require": "./lib/index.cjs"
    },
    "./lib/*": {
      "import": "./lib/index.js",
      "require": "./lib/index.cjs"
    }
  },

This does work on vite 4.0.4, but it does not work on any version >=4.0.4 😖

Screenshot 2023-03-04 at 11 28 29 AM

Reproduction

https://stackblitz.com/edit/vitejs-vite-4weaeh?file=main.js

Steps to reproduce

  1. Create a new vite project
  2. Install the @linode/api-v4
  3. Observe that you can't import that package using the following
import { getAccount } from '@linode/api-v4/lib/account'

System Info

System:
    OS: macOS 13.2.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 1.50 GB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.14.1 - ~/.volta/tools/image/node/18.14.1/bin/node
    Yarn: 1.22.19 - ~/.volta/tools/image/yarn/1.22.19/bin/yarn
    npm: 9.3.1 - ~/.volta/tools/image/node/18.14.1/bin/npm
  Browsers:
    Chrome: 110.0.5481.177
    Safari: 16.3

Used Package Manager

yarn

Logs

No response

Validations

@stackblitz
Copy link

stackblitz bot commented Mar 3, 2023

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

@bnussman
Copy link
Contributor

bnussman commented Mar 4, 2023

The issue seems to be fixed by changing the resolve.exports version to 1.0.1. Could something be wrong with that package or is there something I'm missing?

@bluwy
Copy link
Member

bluwy commented Mar 4, 2023

Yeah this seems to be an upstream bug. Ideally it should be fixed upstream. I see you've opened lukeed/resolve.exports#26

@bluwy bluwy added bug: upstream Bug in a dependency of Vite regression The issue only appears after a new release and removed pending triage labels Mar 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of Vite regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants