Skip to content

Commit

Permalink
fix: always use node condition (#1919)
Browse files Browse the repository at this point in the history
* fix: always use node condition

* test: test for importing a file in different environments

* chore: add import to conditions

* chore: update lockfile

* chore: lint

* chore: fix lock

* chore: add only "node" condition, import/require should be dynamicaly decided by Node in runtime

* chore: disable browserField in exports
  • Loading branch information
sheremet-va authored Oct 28, 2022
1 parent 6beaf42 commit 0be5024
Show file tree
Hide file tree
Showing 15 changed files with 1,864 additions and 474 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"pnpm": {
"overrides": {
"esbuild": "^0.14.47",
"vite": "^3.1.0",
"vite": "^3.2.0",
"vitest": "workspace:*",
"rollup": "^2.79.0"
}
Expand Down
4 changes: 4 additions & 0 deletions packages/vitest/src/node/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export async function VitestPlugin(options: UserConfig = {}, ctx = new Vitest('t
// setting this option can bypass that and fallback to cjs version
mainFields: [],
alias: preOptions.alias,
conditions: ['node'],
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
// @ts-ignore we support Vite ^3.0, but browserField is available in Vite ^3.2
browserField: false,
},
server: {
...preOptions.api,
Expand Down
Loading

0 comments on commit 0be5024

Please sign in to comment.