From 1adf3ef77509d72051b947e35c2609fe93468a16 Mon Sep 17 00:00:00 2001
From: Thomas Sileghem
Date: Fri, 1 Sep 2017 17:13:48 +0100
Subject: [PATCH] fix: make sure paths are consistent from os to os
---
lib/plugin.js | 6 ++++++
spec/plugin.spec.js | 18 ++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/lib/plugin.js b/lib/plugin.js
index 95790e4..eb7feba 100644
--- a/lib/plugin.js
+++ b/lib/plugin.js
@@ -110,6 +110,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);
}
diff --git a/spec/plugin.spec.js b/spec/plugin.spec.js
index 60a82ca..a319717 100644
--- a/spec/plugin.spec.js
+++ b/spec/plugin.spec.js
@@ -398,6 +398,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() {