From 9e1b2584b482633a5f85f0501333cf0345d40eee Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Wed, 4 Dec 2019 00:26:21 +0100 Subject: [PATCH] Fall back to current working directory when no entry file is specified for some reason --- src/phase-streams/dedupe-bundle-css.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/phase-streams/dedupe-bundle-css.js b/src/phase-streams/dedupe-bundle-css.js index 57d7913..c4dd469 100644 --- a/src/phase-streams/dedupe-bundle-css.js +++ b/src/phase-streams/dedupe-bundle-css.js @@ -16,8 +16,11 @@ module.exports = function createDedupeBundleCssStream(options) { let allCss = ""; let loaderItem; - // Get the (absolute!) path of the folder containing the initial entry file, as a reference point for relative paths in the output - let entryPoint = path.dirname(path.resolve(options._flags.entries[0])); + let entryPoint = (options._flags.entries != null) + // Get the (absolute!) path of the folder containing the initial entry file, as a reference point for relative paths in the output + ? path.dirname(path.resolve(options._flags.entries[0])) + // ... or, if no entry file is specified, go off the current working directory + : process.cwd() return stream((item) => { // And the same for the loader shim path. All this relative-path stuff is to prevent absolute filesystem URLs from leaking into the output, as those might contain sensitive information.