bundlers/rollup
Builds an Obsidian plugin with rollup: a rollup plugin that gives a build the same main.js + styles.css + manifest.json layout the esbuild builder produces, deploys a watch build into the vault, and fills in only the options the consumer’s own rollup.config leaves unset.
rollup is an optional peer dependency and this module only imports its types, so a plugin built with esbuild installs nothing extra.
Interfaces
Section titled “Interfaces”| Interface | Description |
|---|---|
| ApplyRollupInputDefaultsParams | Parameters for applyRollupInputDefaults. |
| ApplyRollupOutputDefaultsParams | Parameters for applyRollupOutputDefaults. |
| ObsidianPluginRollupOptions | Options for obsidianPluginRollup. |
Functions
Section titled “Functions”| Function | Description |
|---|---|
| applyRollupInputDefaults | Fills in the rollup input options the consumer left unset. |
| applyRollupOutputDefaults | Fills in the rollup output options the consumer left unset. |
| obsidianPluginRollup | Creates a rollup plugin that builds an Obsidian plugin. What it does, each only when the consumer’s config has not said otherwise: - input is src/main.ts. - The output is one CommonJS main.js in dist/build (dist/dev in watch mode), with dynamic imports inlined, the generated-file banner, and an inline source map in development. And always: Obsidian’s own modules (obsidian, electron, CodeMirror, Lezer) and the Node builtins are external beside the consumer’s own external, the output folder is emptied before the first write, every emitted CSS file ends up in styles.css, manifest.json (and in development .hotreload) is copied beside it, and a development build is deployed into the vault named by OBSIDIAN_CONFIG_FOLDER. TypeScript, dependency resolution and minification stay the consumer’s choice of rollup plugins, as they would be without this one. The build features (ObsidianPluginFeatureOptions) are the plugin’s: - framework: 'react' | 'preact' sets rollup’s jsx option to the automatic runtime (unless set), and the TypeScript plugin reads the same from the toolkit’s tsconfig preset. - framework: 'solid' | 'svelte' compiles the components with the toolkit’s shared transforms, and 'vue' adds unplugin-vue. - Any framework replaces process.env.NODE_ENV (and Vue’s feature flags) in the bundled code. - styles compiles every stylesheet itself (PostCSS, Tailwind, CSS modules), so rollup needs no CSS plugin; leave it out. styles: \{\} compiles plain CSS. - wasm imports a .wasm module as its bytes. |