Fall back to current working directory when no entry file is specified for some reason

pull/1/head
Sven Slootweg 4 years ago
parent c519e107e3
commit 9e1b2584b4

@ -16,8 +16,11 @@ module.exports = function createDedupeBundleCssStream(options) {
let allCss = ""; let allCss = "";
let loaderItem; 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 = (options._flags.entries != null)
let entryPoint = path.dirname(path.resolve(options._flags.entries[0])); // 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) => { 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. // 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.

Loading…
Cancel
Save