Skip to content

Commit

Permalink
docs: add note on nested optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Aug 18, 2021
1 parent f1ad29a commit d6db577
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/config/index.md
Expand Up @@ -707,7 +707,16 @@ createServer()
Dependencies to exclude from pre-bundling.

:::warning CommonJS
CommonJS dependencies should not be excluded from optimization. If an ESM dependency has a nested CommonJS dependency, it should not be excluded as well.
CommonJS dependencies should not be excluded from optimization. If an ESM dependency is excluded from optimization, but has a nested CommonJS dependency, the CommonJS dependency should be added to `optimizeDeps.include`. Example:

```js
export default defineConfig({
optimizeDeps: {
include: ['esm-dep/node_modules/cjs-dep']
}
})
```

:::

### optimizeDeps.include
Expand Down

0 comments on commit d6db577

Please sign in to comment.