From dcb6325103d07770f12f5c1f0edc89fdc3e7bd9d Mon Sep 17 00:00:00 2001 From: Andreas Poehlmann Date: Tue, 5 Oct 2021 12:19:59 +0200 Subject: [PATCH] Fix error in case bundle.getMainEntry() returns null prevents #3 --- src/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index ae7c097..545160b 100644 --- a/src/index.js +++ b/src/index.js @@ -36,7 +36,11 @@ export default new Namer({ return bundle.filePath; } - const { filePath: bundlePath } = bundle.getMainEntry(); + const mainEntry = bundle.getMainEntry(); + if (!mainEntry) { + return null; + } + const { filePath: bundlePath } = mainEntry; const { projectRoot } = options; const pluginConfig = await getPluginConfig(projectRoot);