Skip to content

Commit

Permalink
fix(vite-node): don't externalize "dist" by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed May 25, 2023
1 parent 41e11da commit 3381bf2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/config/index.md
Expand Up @@ -136,7 +136,7 @@ You will not be able to edit your `node_modules` code for debugging, since the c
#### deps.external

- **Type:** `(string | RegExp)[]`
- **Default:** `['**/node_modules/**', '**/dist/**']`
- **Default:** `['**/node_modules/**']`

Externalize means that Vite will bypass the package to native Node. Externalized dependencies will not be applied Vite's transformers and resolvers, so they do not support HMR on reload. Typically, packages under `node_modules` are externalized.

Expand Down
3 changes: 1 addition & 2 deletions packages/vite-node/src/externalize.ts
Expand Up @@ -123,8 +123,7 @@ async function _shouldExternalize(
if (matchExternalizePattern(id, depsExternal))
return id

const isDist = id.includes('/dist/')
if ((isNodeModule || isDist) && await isValidNodeImport(id))
if (isNodeModule && await isValidNodeImport(id))
return id

return false
Expand Down

0 comments on commit 3381bf2

Please sign in to comment.