I'm in the process of implementing rollup
into my mono repo library for better bundling.
Since the library is a mono repo, I want to reuse build configurations for the individual packages. I've tried to do so by outsourcing methods that return specific build configurations
(e.g. createCommonJsConfig()
, createESMConfig()
) into a file called rollup.default.config.ts
which is located at the root of the mono repo.
These functions are then imported into the rollup.config.js
file of each package to create the final rollup configuration
.
// rollup.config.js of an individual package
import {
createCommonJSConfig,
createDeclarationConfig,
createESMConfig,
} from '../rollup.config.default';
// https://rollupjs.org/guide/en/#configuration-files
export default function () {
return [
createDeclarationConfig(),
createCommonJSConfig(),
createESMConfig({ multiFileOutput: true }),
];
}
Unfortunately, as soon as I import the rollup.config.default.ts
file into a rollup.config.js
file of a package, I get this error:
[!] Error: Could not resolve '../rollup.config.default' from rollup.config.js
Does anybody know whether it is possible to somehow modularize a rollup.config.js
file to reuse commonly used parts.
rollup.default.config.ts
: https://github.com/agile-ts/agile/blob/removing-internal/packages/rollup.config.default.tsThanks a lot ;D
Resolved this issue by being consistent with my config
file extension
-> After I've transformed the rollup.default.config.ts
file to a rollup.default.config.js
file it worked as expected.