From 3bd46711742ebc305218dc5c535ef61897840d92 Mon Sep 17 00:00:00 2001 From: c4605 Date: Wed, 3 May 2017 16:38:31 +0800 Subject: [PATCH] use path.join to connect file path --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index d201e1bc..13925639 100644 --- a/src/index.js +++ b/src/index.js @@ -669,7 +669,7 @@ export default class OfflinePlugin { relativeBase = relativeBase + '/'; } - tool.basePath = relativeBase[0] === '.' ? relativeBase : './' + relativeBase; + tool.basePath = relativeBase[0] === '.' ? relativeBase : path.join('./', relativeBase); } else if (this.publicPath) { tool.basePath = this.publicPath.replace(/\/$/, '') + '/'; } @@ -698,7 +698,7 @@ export default class OfflinePlugin { return _path; } - return tool.basePath + _path; + return path.join(tool.basePath, _path); }); } else { tool.pathRewrite = (path => { @@ -726,7 +726,7 @@ export default class OfflinePlugin { return key; } - return this.publicPath + key.replace(/^\.?\//, ''); + return path.join(this.publicPath, key.replace(/^\.?\//, '')); }); }