From c578e3867e02ac7caaacb66a2e78ea4d95da4791 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 | 16 ++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/lib/plugin.js b/lib/plugin.js
index 95790e4..48ad469 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('\\', '/');
+ file.path = file.path.replace('\\', '/');
+ 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..ab77c7c 100644
--- a/spec/plugin.spec.js
+++ b/spec/plugin.spec.js
@@ -398,6 +398,22 @@ describe('ManifestPlugin', function() {
done();
});
});
+
+ it('should output unix paths', function(done) {
+ webpackCompile({
+ context: __dirname,
+ entry: {
+ 'dir\\main': './fixtures/file.js'
+ }
+ }, {}, function(manifest) {
+ expect(manifest).toBeDefined();
+ expect(manifest).toEqual({
+ 'dir/main.js': 'dir/main.js'
+ });
+
+ done();
+ });
+ });
});
describe('with ExtractTextPlugin', function() {