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

[Bug] Yarn pnp not resolving browser field with Vite and engine.io-client #2471

Closed
1 task
SyntheticGoop opened this issue Feb 12, 2021 · 1 comment
Closed
1 task
Labels
bug Something isn't working

Comments

@SyntheticGoop
Copy link

  • I'd be willing to implement a fix

Describe the bug

I am unsure if this is an issue with Vite or yarn, so I'm posting the issue on both.

When using yarn berry in pnp mode, Vite fails to properly load the package.json browser field from engine.io-client. This results in browser polyfills not loading.

To Reproduce

  1. Initialize a new yarn berry repo
  2. yarn create @vitejs/app
  3. Select preset vue-ts
  4. cd into project
  5. yarn add engine.io-client
  6. In src/main.ts add the following lines import client from 'socket.io-client'; client
  7. yarn dev

Load the site in the browser and open the console. You will see an error from socket.io-client being bundled with the non browser package substitutions.

If you add nodeLinker: node-modules to the .yarnrc.yml file, the browser field detection works properly any you will not see errors.

Additional context

  • vite version: 2.0.0-beta.67
  • Operating System: Pop!_OS 20.04
  • Node version: 14.15.4
  • Package manager (npm/yarn/pnpm) and version: yarn 2.4.0
@SyntheticGoop SyntheticGoop added the bug Something isn't working label Feb 12, 2021
@merceyz
Copy link
Member

merceyz commented Feb 13, 2021

That's an issue in Vite, not in PnP.


Upstream issue vitejs/vite#1979

@merceyz merceyz closed this as completed Feb 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants