mirror of
https://github.com/lancedikson/bowser
synced 2026-10-09 20:32:15 +00:00
fix(build): fail loudly when terser produces no output for a chunk
This commit is contained in:
@@ -46,7 +46,7 @@ const legacyBabel = (useBuiltIns: false | 'entry') => babel({
|
|||||||
*/
|
*/
|
||||||
const terser = () => ({
|
const terser = () => ({
|
||||||
name: 'bowser:terser',
|
name: 'bowser:terser',
|
||||||
async renderChunk(code: string) {
|
async renderChunk(code: string, chunk: { fileName: string }) {
|
||||||
const result = await minify(code, {
|
const result = await minify(code, {
|
||||||
ecma: 5,
|
ecma: 5,
|
||||||
// IE 8: reserved words as property names must stay quoted.
|
// IE 8: reserved words as property names must stay quoted.
|
||||||
@@ -57,7 +57,10 @@ const terser = () => ({
|
|||||||
comments: /^!/,
|
comments: /^!/,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return { code: result.code as string };
|
if (typeof result.code !== 'string') {
|
||||||
|
throw new Error(`terser produced no output for ${chunk.fileName}`);
|
||||||
|
}
|
||||||
|
return { code: result.code };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user