griffel/tools/getRollupOptions.js

21 строка
600 B
JavaScript
Исходник Постоянная ссылка Обычный вид История

function getRollupOptions(/** @type {import('rollup').RollupOptions} */ options) {
if (Array.isArray(options.output)) {
2024-06-29 00:18:44 +03:00
options.output = options.output.map(output => ({
...output,
// Stops bundling to a single file and prevents bundle size issues
preserveModules: true,
preserveModulesRoot: 'src',
// Enables sourcemaps
sourcemap: true,
2024-07-04 14:24:51 +03:00
// Add interop for CJS
...(output.format === 'cjs' && { interop: 'compat' }),
2024-06-29 00:18:44 +03:00
}));
2024-06-29 00:18:44 +03:00
return options;
}
2023-02-13 16:01:55 +03:00
2024-06-29 00:18:44 +03:00
throw new Error('"options.output" should be an array');
}
module.exports = getRollupOptions;