From 63cc2ebcb4ec39a81352df6eb634a9af2dfb1fd3 Mon Sep 17 00:00:00 2001 From: Satoshi Amemiya Date: Thu, 6 Feb 2020 16:06:06 +0900 Subject: [PATCH 1/2] warn.code for missing output.name of IIFE bundle that has export --- src/finalisers/iife.ts | 1 + test/function/samples/warn-missing-iife-name/_config.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/finalisers/iife.ts b/src/finalisers/iife.ts index 706e2f62429..6fdab00d59f 100644 --- a/src/finalisers/iife.ts +++ b/src/finalisers/iife.ts @@ -49,6 +49,7 @@ export default function iife( if (hasExports && !name) { warn({ + code: 'MISSING_NAME_FOR_EXPORT', message: `If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.` }); } diff --git a/test/function/samples/warn-missing-iife-name/_config.js b/test/function/samples/warn-missing-iife-name/_config.js index 2326bd1f959..db756f49721 100644 --- a/test/function/samples/warn-missing-iife-name/_config.js +++ b/test/function/samples/warn-missing-iife-name/_config.js @@ -3,6 +3,7 @@ module.exports = { options: { output: { format: 'iife' } }, warnings: [ { + code: 'MISSING_NAME_FOR_EXPORT', message: 'If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.' } From 2b3e3ef00be7e91ef49cb8f114238b80f4a27e41 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 6 Mar 2020 07:03:19 +0100 Subject: [PATCH 2/2] Make warning code slightly more descriptive --- src/finalisers/iife.ts | 2 +- test/function/samples/warn-missing-iife-name/_config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/finalisers/iife.ts b/src/finalisers/iife.ts index 6fdab00d59f..5f5aec49a33 100644 --- a/src/finalisers/iife.ts +++ b/src/finalisers/iife.ts @@ -49,7 +49,7 @@ export default function iife( if (hasExports && !name) { warn({ - code: 'MISSING_NAME_FOR_EXPORT', + code: 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT', message: `If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.` }); } diff --git a/test/function/samples/warn-missing-iife-name/_config.js b/test/function/samples/warn-missing-iife-name/_config.js index db756f49721..07c9331fb90 100644 --- a/test/function/samples/warn-missing-iife-name/_config.js +++ b/test/function/samples/warn-missing-iife-name/_config.js @@ -3,7 +3,7 @@ module.exports = { options: { output: { format: 'iife' } }, warnings: [ { - code: 'MISSING_NAME_FOR_EXPORT', + code: 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT', message: 'If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.' }