Skip to content

Commit

Permalink
fix(vitest): throw an error if vitest is imported using require() (#4466
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sheremet-va committed Nov 13, 2023
1 parent a2d4d22 commit e5cf141
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vitest/index.cjs
@@ -0,0 +1,5 @@
throw new Error(
'Vitest cannot be imported in a CommonJS module using require(). Please use "import" instead.'
+ '\n\nIf you are using "import" in your source code, then it\'s possible it was bundled into require() automatically by your bundler. '
+ 'In that case, do not bundle CommonJS output since it will never work with Vitest, or use dynamic import() which is available in all CommonJS modules.',
)

0 comments on commit e5cf141

Please sign in to comment.