Don't break when options._flags is undefined entirely

pull/2/head
Sven Slootweg 4 years ago
parent 92bcf4fdca
commit 3efa28c9f1

@ -18,7 +18,7 @@ module.exports = function (state) {
let allCss = "";
let loaderItem;
let entryPoint = (options._flags.entries != null)
let entryPoint = (options._flags != null && 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
@ -56,6 +56,7 @@ module.exports = function (state) {
source: loaderItem.source.replace('"## CONTENT MARKER ##"', JSON.stringify(allCss))
};
} else {
// FIXME: Can occur if some dependency also gets processed and require()s a CSS file, but does not specify icssify as a transform (but the using project does) -- like with ui-lib + site-builder
throw new Error("Processed CSS, but global loader was not encountered. This should never happen, please report it as a bug!");
}
}

Loading…
Cancel
Save