Skip to content

Commit 87decf4

Browse files
committed
[fix] mkdirp is not called properly on Windows
1 parent 65079e9 commit 87decf4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/Compiler.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5+
var path = require("path");
56
var clone = require("clone");
67
var Tapable = require("tapable");
78

@@ -235,9 +236,9 @@ Compiler.prototype.emitAssets = function(compilation, callback) {
235236
if(queryStringIdx >= 0) {
236237
targetFile = targetFile.substr(0, queryStringIdx);
237238
}
238-
if(targetFile.indexOf("/") >= 0) {
239-
var idx = targetFile.lastIndexOf("/");
240-
var dir = targetFile.substr(0, idx);
239+
240+
if(targetFile.match(/\/|\\/)) {
241+
var dir = path.dirname(targetFile);
241242
this.outputFileSystem.mkdirp(this.outputFileSystem.join(outputPath, dir), writeOut.bind(this));
242243
} else writeOut.call(this);
243244
function writeOut(err) {

0 commit comments

Comments
 (0)