From 3767f28240ffd87676d6e965c649188aedd9d301 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Tue, 19 Mar 2019 00:52:55 -0700 Subject: [PATCH] fix(webpack-plugin): create output folder with mkdirp (#273) --- packages/webpack-plugin/package.json | 3 +++ packages/webpack-plugin/src/index.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/webpack-plugin/package.json b/packages/webpack-plugin/package.json index 049087f1..df9dcd5b 100644 --- a/packages/webpack-plugin/package.json +++ b/packages/webpack-plugin/package.json @@ -22,5 +22,8 @@ }, "peerDependencies": { "webpack": ">=4.6.0" + }, + "dependencies": { + "mkdirp": "^0.5.1" } } diff --git a/packages/webpack-plugin/src/index.js b/packages/webpack-plugin/src/index.js index c31bbaa1..cd50aa9e 100644 --- a/packages/webpack-plugin/src/index.js +++ b/packages/webpack-plugin/src/index.js @@ -1,5 +1,6 @@ const nodePath = require('path') const fs = require('fs') +const mkdirp = require('mkdirp') class LoadablePlugin { constructor({ @@ -57,7 +58,7 @@ class LoadablePlugin { try { if (!fs.existsSync(outputFolder)) { - fs.mkdirSync(outputFolder) + mkdirp.sync(outputFolder) } } catch (err) { if (err.code !== 'EEXIST') {