-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Documentation Is:
- Missing
- Needed
- Confusing
- Not Sure?
Please Explain in Detail...
I'm not entirely sure if what I'm asking about is possible, this might be a feature request. Per the title, I have a few entry points, and each of those needs to output multiple formats, and chunks should be shared between them.
So something like:
rollup({
input: ['src/ponyfill.js', 'src/polyfill.js'],
output: [{
dir: 'dist/esm/'
format: 'esm'
}, {
dir: 'dist/cjs/'
format: 'cjs'
}]
})
Where src/polyfill.js
imports src/ponyfill.js
.
And, ideally would like to be able to have per-output plugins too, e.g. for minified vs. non-minified bundle.
This is related to #3325, as:
- Can't do multiple configs via the API
bundle.write
only takes oneOutputOptions
, not an array ofOutputOptions
, so I think this isn't possible via the API
Based on 2. I think I'd currently have to run rollup
and bundle.write
once on each format right now, which is pretty time-consuming as none of the work is re-used between formats.
This is something I'm running into in with supporting multiple entries in TSDX: jaredpalmer/tsdx#367 . Currently rollup
is ran on each format and on each input, which is very time-consuming and, more problematically, no code is shared between the two bundles.
Also seems related to the quite older #1150
Your Proposal for Changes
Clarify if this is possible (with the API and CLI). If not, what are the current workarounds? Running rollup
for each format with multiple inputs?