Skip to content

Commit

Permalink
feat(dev): update deps.external behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
fooddilsn committed May 25, 2023
1 parent ba426bc commit 4022b8d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 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:** `[]`

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
2 changes: 1 addition & 1 deletion packages/vite-node/src/externalize.ts
Expand Up @@ -140,7 +140,7 @@ function matchExternalizePattern(id: string, patterns?: (string | RegExp)[] | tr
return true
for (const ex of patterns) {
if (typeof ex === 'string') {
if (id.includes(`/node_modules/${ex}/`))
if (id.includes(`/${ex.replace(/(^\/?|\/?$)/g, '')}/`))
return true
}
else {
Expand Down

0 comments on commit 4022b8d

Please sign in to comment.