I am working on a few web applications and have been trying to use Rollup to bundle my code. I've made a little program that can do the bundling for me. However I've run into a problem with formatting IIFE.
I've tried other formats like 'es' and 'amd', but ran into different problems. I read a bit and it seems like IIFE is the most fitting format.
I get this error in the console when trying to bundle:
UnhandledPromiseRejectionWarning: Error: UMD and IIFE output formats are not supported for code-splitting builds
Here is the code for the bundling:
function createBundle(slug, destinationPath) {
const config = {
input: './apps/' + slug + '/index.js',
preserveEntrySignatures: false,
plugins: [resolve({preferBuiltins: false}), common()]
}
rollup.rollup(config).then((bundle) => {
bundle.generate({format: 'iife'}).then((result) => { //'es' 'cjs' 'amd'
compileCode('app.js', result.output[0].code, destinationPath);
});
});
}
Does anyone know a fix for this or have suggestions for how to solve it?