fixed missing mkdirp for records, #90
This commit is contained in:
parent
4c3d903603
commit
7df05c7ddc
|
@ -233,7 +233,20 @@ Compiler.prototype.emitAssets = function(compilation, callback) {
|
||||||
|
|
||||||
Compiler.prototype.emitRecords = function emitRecords(callback) {
|
Compiler.prototype.emitRecords = function emitRecords(callback) {
|
||||||
if(!this.recordsOutputPath) return callback();
|
if(!this.recordsOutputPath) return callback();
|
||||||
this.outputFileSystem.writeFile(this.recordsOutputPath, JSON.stringify(this.records, undefined, 2), callback);
|
var idx1 = this.recordsOutputPath.lastIndexOf("/");
|
||||||
|
var idx2 = this.recordsOutputPath.lastIndexOf("\\");
|
||||||
|
var recordsOutputPathDirectory = null;
|
||||||
|
if(idx1 > idx2) recordsOutputPathDirectory = this.recordsOutputPath.substr(0, idx1);
|
||||||
|
if(idx1 < idx2) recordsOutputPathDirectory = this.recordsOutputPath.substr(0, idx2);
|
||||||
|
if(!recordsOutputPathDirectory) return writeFile.call(this);
|
||||||
|
this.outputFileSystem.mkdirp(recordsOutputPathDirectory, function(err) {
|
||||||
|
if(err) return callback(err);
|
||||||
|
writeFile.call(this)
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
function writeFile() {
|
||||||
|
this.outputFileSystem.writeFile(this.recordsOutputPath, JSON.stringify(this.records, undefined, 2), callback);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Compiler.prototype.readRecords = function readRecords(callback) {
|
Compiler.prototype.readRecords = function readRecords(callback) {
|
||||||
|
@ -245,7 +258,7 @@ Compiler.prototype.readRecords = function readRecords(callback) {
|
||||||
// It doesn't exist
|
// It doesn't exist
|
||||||
// We can ignore this.
|
// We can ignore this.
|
||||||
if(err) return callback();
|
if(err) return callback();
|
||||||
|
|
||||||
this.inputFileSystem.readFile(this.recordsInputPath, function(err, content) {
|
this.inputFileSystem.readFile(this.recordsInputPath, function(err, content) {
|
||||||
if(err) return callback(err);
|
if(err) return callback(err);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "webpack",
|
"name": "webpack",
|
||||||
"version": "0.10.0-beta18",
|
"version": "0.10.0-beta19",
|
||||||
"author": "Tobias Koppers @sokra",
|
"author": "Tobias Koppers @sokra",
|
||||||
"description": "Packs CommonJs/AMD/Labeled Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
|
"description": "Packs CommonJs/AMD/Labeled Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -28,8 +28,10 @@ app.configure(function() {
|
||||||
optimize: {
|
optimize: {
|
||||||
minimize: true
|
minimize: true
|
||||||
},
|
},
|
||||||
|
recordsPath: path.join(__dirname, "webpack.records.json"),
|
||||||
output: {
|
output: {
|
||||||
publicPath: "http://localhost:8080/js/",
|
publicPath: "http://localhost:8080/js/",
|
||||||
|
path: "/",
|
||||||
filename: "web.js"
|
filename: "web.js"
|
||||||
}
|
}
|
||||||
}), {
|
}), {
|
||||||
|
|
Loading…
Reference in New Issue