Skip to content

Commit

Permalink
fix: make sure paths are consistent from os to os (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
mastilver authored Sep 10, 2017
1 parent 4cb95ce commit 21caffc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ ManifestPlugin.prototype.apply = function(compiler) {
}.bind(this));
}

files = files.map(file => {
file.name = file.name.replace(/\\/g, '/');
file.path = file.path.replace(/\\/g, '/');
return file;
});

if (this.opts.filter) {
files = files.filter(this.opts.filter);
}
Expand Down
18 changes: 18 additions & 0 deletions spec/plugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,24 @@ describe('ManifestPlugin', function() {
done();
});
});

it('should output unix paths', function(done) {
webpackCompile({
context: __dirname,
entry: {
'dir\\main': './fixtures/file.js',
'some\\dir\\main': './fixtures/file.js'
}
}, {}, function(manifest) {
expect(manifest).toBeDefined();
expect(manifest).toEqual({
'dir/main.js': 'dir/main.js',
'some/dir/main.js': 'some/dir/main.js'
});

done();
});
});
});

describe('with ExtractTextPlugin', function() {
Expand Down

0 comments on commit 21caffc

Please sign in to comment.