Skip to content

Instantly share code, notes, and snippets.

@GitaiQAQ
Last active September 3, 2020 05:29
Show Gist options
  • Select an option

  • Save GitaiQAQ/21036df6ffefd48d22045fb677c10171 to your computer and use it in GitHub Desktop.

Select an option

Save GitaiQAQ/21036df6ffefd48d22045fb677c10171 to your computer and use it in GitHub Desktop.
import replace from '@rollup/plugin-replace';
let manifest = {};
export const replaceManifest = () => {
return replace({
__MANIFEST__: () => JSON.stringify(manifest),
});
};
export default () => ({
name: 'Manifest Collection',
generateBundle(_, bundles) {
manifest = {
...manifest,
...Object.assign.apply(null, Object.entries(bundles).map(([key, bundle]) => ({
[bundle.name]: key,
}))),
};
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment