linked package's .mjs
files cannot be externalized via test.server.deps.external
#6554
Open
6 tasks done
Labels
.mjs
files cannot be externalized via test.server.deps.external
#6554
Describe the bug
For the issue #6543, I was suggesting to externalize monorepo packages, but while testing it out, I noticed
.mjs
outside ofnode_modules
is currently inlined due toextraInlineDeps
vitest/packages/vitest/src/constants.ts
Lines 8 to 13 in 2a50464
Since Vite-node matches
options.inline
beforeoptions.external
, it doesn't look possible to externalize linked package's.mjs
.vitest/packages/vite-node/src/externalize.ts
Lines 119 to 124 in 2a50464
Is there any way to achieve this? It looks like this might be desired in some case though not many. If we check
options.external
beforeoptions.inline
, then that would allow it but not sure how breaking this change would be.Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-tq3er6?file=vite.config.ts
With a package exporting
linked-dep/good.js
andlinked-dep/bad.mjs
, usingtest.server.deps.external: [/\/linked-dep\//]
externalizes onlylinked-dep/good.js
. Here is a log fromDEBUG=vite-node:* vitest
:System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: