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

Entry always resolves to "browser" field in mono repo (SSR) #1916

Closed
2 of 3 tasks
egoist opened this issue Feb 6, 2021 · 1 comment
Closed
2 of 3 tasks

Entry always resolves to "browser" field in mono repo (SSR) #1916

egoist opened this issue Feb 6, 2021 · 1 comment

Comments

@egoist
Copy link
Contributor

egoist commented Feb 6, 2021

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

In SSR, if pkg browser field or alternative (like exports.browser) is present, it's always used as pkg entry.

This only happens in mono repos, packages installed in node_modules are correctly resolved.

Reproduction

Create a package in Vite monorepo itself:

packages/foo/node.js:

console.log('node')

packages/foo/browser.js:

console.log('browser')

packages/foo/package.json:

{
  "name": "foo",
  "version": "0.0.0",
  "main": "node.js",
  "browser": "browser.js"
}

And import the package in packages/playground/ssr-vue/src/main.js:

import 'foo'

Run yarn workspace test-ssr-vue dev, it always prints browser.

System Info

  • vite version: 2.0.0-beta.65 main branch (185a727715db4a)
  • Operating System:
  • Node version:
  • Package manager (npm/yarn/pnpm) and version:
@yyx990803
Copy link
Member

fixed via 92934d4

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants