Skip to content

Commit

Permalink
Add strip prefix multi windows support (#76)
Browse files Browse the repository at this point in the history
Add strip prefix multi windows support (fixes #11)
  • Loading branch information
goldhand authored May 19, 2017
1 parent 2fa40b6 commit bf14a8d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class SWPrecacheWebpackPlugin {
importScripts,
staticFileGlobsIgnorePatterns,
mergeStaticsConfig,
stripPrefixMulti = {},
} = this.options;

// get the output path used by webpack
Expand All @@ -110,13 +111,9 @@ class SWPrecacheWebpackPlugin {
(!staticFileGlobsIgnorePatterns.some((regex) => regex.test(text)))
);

const stripPrefixMulti = {
...this.options.stripPrefixMulti,
};

if (outputPath) {
// strip the webpack config's output.path
stripPrefixMulti[`${outputPath}${path.sep}`] = publicPath;
// strip the webpack config's output.path (replace for windows users)
stripPrefixMulti[`${outputPath}${path.sep}`.replace(/\\/g, '/')] = publicPath;
}

this.config = {
Expand Down

0 comments on commit bf14a8d

Please sign in to comment.