Minify worker source

This commit is contained in:
Tim Schaub
2019-05-16 10:35:18 -06:00
parent 442fbb13d2
commit d49e166506

View File

@@ -29,8 +29,14 @@ async function build(input, {minify = true} = {}) {
} }
] ]
] ]
}), })
{ ];
if (minify) {
plugins.push(terser());
}
plugins.push({
name: 'serialize worker and export create function', name: 'serialize worker and export create function',
renderChunk(code) { renderChunk(code) {
return ` return `
@@ -42,12 +48,7 @@ async function build(input, {minify = true} = {}) {
} }
`; `;
} }
} });
];
if (minify) {
plugins.push(terser());
}
const bundle = await rollup.rollup({input, plugins}); const bundle = await rollup.rollup({input, plugins});
const {output} = await bundle.generate({format: 'es'}); const {output} = await bundle.generate({format: 'es'});