Skip to content

Commit

Permalink
chore(examples): output error if webpack-cli isn't installed
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Apr 3, 2019
1 parent dc26688 commit 1a63b4a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/build-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const doCompileAndReplace = (args, prefix, callback) => {
if(fs.existsSync("dist"))
for(const file of fs.readdirSync("dist"))
fs.unlinkSync(`dist/${file}`);

try {
require.resolve("webpack-cli");
} catch (e) {
throw new Error("Please install webpack-cli at root.");
}

cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${args} ${displayReasons} ${commonArgs}`, (error, stdout, stderr) => {
if(stderr)
console.log(stderr);
Expand Down

0 comments on commit 1a63b4a

Please sign in to comment.