UNPKG

@rechunk/rollup-preset

Version:

Rollup configuration preset for bundling ReChunk components and modules

46 lines (43 loc) 1.57 kB
import { RollupOptions } from 'rollup'; /** * Babel overrides to disable specific plugins for compatibility with Rollup. * * Rollup relies on ES6 module syntax (`import`/`export`) to perform tree-shaking * and bundling optimizations. However, some Babel plugins, like `@babel/plugin-transform-modules-commonjs`, * convert ES6 modules to CommonJS (`require`/`module.exports`). This transformation * interferes with Rollup's ability to optimize and bundle the code effectively. * * By disabling such plugins (e.g., `module-resolver`), we ensure that ES6 module * syntax remains intact, allowing Rollup to handle the module bundling correctly. * * @constant * @example * ```typescript * import babel from '@rollup/plugin-babel'; * import { BABEL_ROLLUP_OVERRIDES } from './babelOverrides'; * * export default { * plugins: [ * babel({ * ...BABEL_ROLLUP_OVERRIDES, * }), * ], * }; * ``` */ declare const BABEL_ROLLUP_OVERRIDES: { overrides: { plugins: (string | boolean)[][]; }[]; }; /** * A Rollup preset function that extends the provided options with a default configuration. * * This preset processes single or multiple Rollup configuration objects, applying the * `processOptions` function to each. * * @param options - The Rollup configuration or array of configurations to extend. * @returns A fully configured Rollup configuration or an array of configurations. */ declare function withRechunk(options?: RollupOptions): Promise<RollupOptions>; export { BABEL_ROLLUP_OVERRIDES, withRechunk as default };