Skip to content

Commit

Permalink
fix: don't resolve import using browser during SSR (fix #2995) (#2996)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Apr 15, 2021
1 parent 41261c7 commit fd1c9ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/vite/src/node/plugins/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ export function resolvePlugin(baseOptions: InternalResolveOptions): Plugin {
const fsPath = path.resolve(basedir, id)
// handle browser field mapping for relative imports

if ((res = tryResolveBrowserMapping(fsPath, importer, options, true))) {
if (
!ssr &&
(res = tryResolveBrowserMapping(fsPath, importer, options, true))
) {
return res
}

Expand Down

0 comments on commit fd1c9ba

Please sign in to comment.