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
​
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.developmentMode
​
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
​
The false
is disabled jsx parser, it will give you a syntax error if you use jsx syntax
The mode: preserve
is disabled jsx transformer, it perverse original jsx syntax in the output.
The mode: classic
is enabled jsx classic
transformer.
The mode: automatic
is enabled jsx automatic
transformer.
watch
​
dropLabels
​
keepNames
​
checks
​
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
​
sourcemapIgnoreList
​
sourcemapPathTransform
​
banner
​
footer
​
intro
​
outro
​
extend
​
esModule
​
assetFileNames
​
entryFileNames
​
chunkFileNames
​
cssEntryFileNames
​
cssChunkFileNames
​
sanitizeFileName
​
minify
​
name
​
globals
​
externalLiveBindings
​
inlineDynamicImports
​
advancedChunks
​
advancedChunks.minSize
​
advancedChunks.maxSize
​
advancedChunks.maxModuleSize
​
advancedChunks.minModuleSize
​
advancedChunks.minShareCount
​
advancedChunks.groups
​
advancedChunks.groups.name
​
advancedChunks.groups.test
​
advancedChunks.groups.priority
​
advancedChunks.groups.minSize
​
advancedChunks.groups.minShareCount
​
advancedChunks.groups.maxSize
​
advancedChunks.groups.maxModuleSize
​
advancedChunks.groups.minModuleSize
​
comments
​
Control comments in the output.
none
: no commentspreserve-legal
: preserve comments that contain@license
,@preserve
or starts with//!
/*!