Config Options
🚧 Under Construction
We are working on generating a more detailed reference. For now, please refer to Rollup's Config Options Reference and documentation on additional notable features.
InputOptions
​
input
​
plugins
​
external
​
resolve
​
resolve.alias
​
WARNING
resolve.alias
will not call resolveId
hooks of other plugin.
If you want to call resolveId
hooks of other plugin, use aliasPlugin
from rolldown/experimental
instead.
You could find more discussion in this issue
resolve.aliasFields
​
resolve.conditionNames
​
resolve.extensionAlias
​
Map of extensions to alternative extensions.
With writing import './foo.js'
in a file, you want to resolve it to foo.ts
instead of foo.js
.
You can achieve this by setting: extensionAlias: { '.js': ['.ts', '.js'] }
.
resolve.exportsFields
​
resolve.extensions
​
resolve.mainFields
​
resolve.mainFiles
​
resolve.modules
​
resolve.symlinks
​
resolve.tsconfigFilename
​
cwd
​
platform
​
Expected platform where the code run.
shimMissingExports
​
treeshake
​
logLevel
​
onLog
​
onwarn
​
moduleTypes
​
experimental
​
experimental.enableComposingJsPlugins
​
experimental.strictExecutionOrder
​
experimental.disableLiveBindings
​
experimental.viteMode
​
experimental.resolveNewUrlToAsset
​
experimental.hmr
​
define
​
Replace global variables or property accessors with the provided values.
Examples ​
- Replace the global variable
IS_PROD
withtrue
export default defineConfig({ define: { IS_PROD: 'true' // or JSON.stringify(true) } })
Result:
// Input
if (IS_PROD) {
console.log('Production mode')
}
// After bundling
if (true) {
console.log('Production mode')
}
- Replace the property accessor
process.env.NODE_ENV
with'production'
export default defineConfig({ define: { 'process.env.NODE_ENV': "'production'" } })
Result:
// Input
if (process.env.NODE_ENV === 'production') {
console.log('Production mode')
}
// After bundling
if ('production' === 'production') {
console.log('Production mode')
}
inject
​
Inject import statements on demand.
Supported patterns ​
{
// import { Promise } from 'es6-promise'
Promise: ['es6-promise', 'Promise'],
// import { Promise as P } from 'es6-promise'
P: ['es6-promise', 'Promise'],
// import $ from 'jquery'
$: 'jquery',
// import * as fs from 'node:fs'
fs: ['node:fs', '*'],
// Inject shims for property access pattern
'Object.assign': path.resolve( 'src/helpers/object-assign.js' ),
}
profilerNames
​
jsx
​
false
disables the JSX parser, resulting in a syntax error if JSX syntax is used."preserve"
disables the JSX transformer, preserving the original JSX syntax in the output."react"
enables theclassic
JSX transformer."react-jsx"
enables theautomatic
JSX transformer.
transform
​
watch
​
dropLabels
​
keepNames
​
checks
​
makeAbsoluteExternalsRelative
​
OutputOptions
​
dir
​
file
​
exports
​
hashCharacters
​
format
​
Expected format of generated code.
'es'
,'esm'
and'module'
are the same format, all stand for ES module.'cjs'
and'commonjs'
are the same format, all stand for CommonJS module.'iife'
stands for Immediately Invoked Function Expression.'umd'
stands for Universal Module Definition.
sourcemap
​
sourcemapDebugIds
​
sourcemapIgnoreList
​
sourcemapPathTransform
​
banner
​
footer
​
intro
​
outro
​
extend
​
esModule
​
assetFileNames
​
entryFileNames
​
chunkFileNames
​
cssEntryFileNames
​
cssChunkFileNames
​
sanitizeFileName
​
minify
​
name
​
globals
​
externalLiveBindings
​
inlineDynamicImports
​
advancedChunks
​
Allows you to do advanced chunking. Use it to reduce the number of common chunks or split out a chunk that hardly changes to obtain better caching.
advancedChunks.minSize
​
- Type:
number
Global fallback of {group}.minSize
, if it's not specified in the group.
advancedChunks.maxSize
​
- Type:
number
Global fallback of {group}.maxSize
, if it's not specified in the group.
advancedChunks.maxModuleSize
​
- Type:
number
Global fallback of {group}.maxModuleSize
, if it's not specified in the group.
advancedChunks.minModuleSize
​
- Type:
number
Global fallback of {group}.minModuleSize
, if it's not specified in the group.
advancedChunks.minShareCount
​
- Type:
number
Global fallback of {group}.minShareCount
, if it's not specified in the group.
advancedChunks.groups
​
Groups to be used for advanced chunking.
advancedChunks.groups.name
​
- Type:
string
Name of the group. It will be also used as the name of the chunk and replaced the [name]
placeholder in the chunkFileNames
option.
advancedChunks.groups.test
​
- Type:
string | RegExp
Controls which modules are captured in this group.
If test
is a string, the module whose id contains the string will be captured.
If test
is a regular expression, the module whose id matches the regular expression will be captured.
if test
is empty, any module will be considered as matched.
advancedChunks.groups.priority
​
- Type:
number
Priority of the group. Group with higher priority will be chosen first to match modules and create chunks. When converting the group to a chunk, modules of that group will be removed from other groups.
If two groups have the same priority, the group whose index is smaller will be chosen.
advancedChunks.groups.minSize
​
- Type:
number
- Default:
0
Minimum size of the desired chunk. If accumulated size of captured modules is smaller than this value, this group will be ignored.s
advancedChunks.groups.minShareCount
​
- Type:
number
- Default:
1
Controls if a module should be captured based on how many entry chunks reference it.
advancedChunks.groups.maxSize
​
- Type:
number
- Default:
Infinity
If final size of this group is larger than this value, this group will be spit into multiple groups that each has size closed to this value.
advancedChunks.groups.maxModuleSize
​
- Type:
number
- Default:
Infinity
Controls a module could only be captured if its size is smaller or equal than this value.
advancedChunks.groups.minModuleSize
​
- Type:
number
- Default:
0
Controls a module could only be captured if its size is larger or equal than this value.
comments
​
Control comments in the output.
none
: no commentspreserve-legal
: preserve comments that contain@license
,@preserve
or starts with//!
/*!