Skip to content

Commit bf40067

Browse files
committed
replace [hash] in output.path
fixes webpack#199
1 parent 8ec3791 commit bf40067

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎lib/Compiler.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var Tapable = require("tapable");
77

88
var Compilation = require("./Compilation");
99
var Parser = require("./Parser");
10+
var Template = require("./Template");
1011
var Resolver = require("enhanced-resolve/lib/Resolver");
1112

1213
var NormalModuleFactory = require("./NormalModuleFactory");
@@ -191,16 +192,18 @@ Compiler.prototype.emitAssets = function(compilation, callback) {
191192
function emitFiles(err) {
192193
if(err) return callback(err);
193194

195+
var outputPath = this.outputPath.replace(Template.REGEXP_HASH, compilation.hash);
196+
194197
require("async").forEach(Object.keys(compilation.assets), function(file, callback) {
195198

196199
if(file.indexOf("/") >= 0) {
197200
var idx = file.lastIndexOf("/");
198201
var dir = file.substr(0, idx);
199-
this.outputFileSystem.mkdirp(this.outputFileSystem.join(this.outputPath, dir), writeOut.bind(this));
202+
this.outputFileSystem.mkdirp(this.outputFileSystem.join(outputPath, dir), writeOut.bind(this));
200203
} else writeOut.call(this);
201204
function writeOut(err) {
202205
if(err) return callback(err);
203-
var targetPath = this.outputFileSystem.join(this.outputPath, file);
206+
var targetPath = this.outputFileSystem.join(outputPath, file);
204207
var source = compilation.assets[file];
205208
if(source.existsAt === targetPath) {
206209
source.emitted = false;

0 commit comments

Comments
 (0)