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(/^\.?\//, '')); }); }