chore(examples): output error if webpack-cli isn't installed

This commit is contained in:
Yuta Hiroto 2019-04-03 21:26:40 +01:00
parent dc26688731
commit 1a63b4afcd
No known key found for this signature in database
GPG Key ID: E03998F3E2B165C2
1 changed files with 7 additions and 0 deletions

View File

@ -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);