Skip to content

Dep Optimization Options

optimizeDeps.entries

  • Type: string | string[]

By default, Wite will crawl all your .html files to detect dependencies that need to be pre-bundled (ignoring node_modules, build.outDir, __tests__ and coverage). If build.rollupOptions.input is specified, Wite will crawl those entry points instead.

If neither of these fit your needs, you can specify custom entries using this option - the value should be a fast-glob pattern or array of patterns that are relative from Wite project root. This will overwrite default entries inference. Only node_modules and build.outDir folders will be ignored by default when optimizeDeps.entries is explicitly defined. If other folders needs to be ignored, you can use an ignore pattern as part of the entries list, marked with an initial !.

optimizeDeps.exclude

  • Type: string[]

Dependencies to exclude from pre-bundling.

CommonJS

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:

export default defineConfig({
  optimizeDeps: {
    include: ['esm-dep > cjs-dep']
  }
})

optimizeDeps.include

  • Type: string[]

By default, linked packages not inside node_modules are not pre-bundled. Use this option to force a linked package to be pre-bundled.

optimizeDeps.esbuildOptions

Options to pass to esbuild during the dep scanning and optimization.

Certain options are omitted since changing them would not be compatible with Wite's dep optimization.

  • external is also omitted, use Wite's optimizeDeps.exclude option
  • plugins are merged with Wite's dep plugin

optimizeDeps.force

  • Type: boolean

Set to true to force dependency pre-bundling, ignoring previously cached optimized dependencies.

Released under the MIT License.