From bc06121a180f72ae31f97d1be787b52ce92adc15 Mon Sep 17 00:00:00 2001 From: ssube Date: Tue, 30 Jun 2020 08:03:35 -0500 Subject: [PATCH] fix(build): add chunk for linked modules to fix cyclical imports, sort test modules into test chunk --- config/rollup-external.json | 1 + config/rollup.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config/rollup-external.json b/config/rollup-external.json index 02d9402..1880744 100644 --- a/config/rollup-external.json +++ b/config/rollup-external.json @@ -2,6 +2,7 @@ "names": [ "async_hooks", "chai", + "fs", "js-yaml", "sinon" ] diff --git a/config/rollup.js b/config/rollup.js index a79a1b5..2c5fe99 100644 --- a/config/rollup.js +++ b/config/rollup.js @@ -42,13 +42,9 @@ const bundle = { return 'vendor'; } - if (id.includes(process.env['HOME'])) { - return 'linked'; - } - - /* if (id.includes(`chai`) || id.includes(`sinon`)) { + if (id.includes(`chai`) || id.includes(`sinon`) || id.includes('source-map')) { return 'test'; - } */ + } if (id.includes(`${sep}node_modules${sep}`)) { return 'vendor'; @@ -62,14 +58,18 @@ const bundle = { return 'main'; } - if (flag_debug) { - console.log('file does not belong to any chunk:', id); + if (id.includes(process.env['HOME'])) { + return 'linked'; } if (id.length === 30 && id.match(/^[a-f0-9]+$/)) { return 'vendor'; } + if (flag_debug) { + console.log('file does not belong to any chunk:', id); + } + return 'nochunk'; }, output: {