Created
October 22, 2018 06:42
-
-
Save pekkis/b9c5c289f0dabb4b10589f8b0d000a64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myFeature = require("./src/config/workboxFeature"); | |
addFeatures( | |
..., | |
myFeature, | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src/config/workboxFeature.js | |
const { OrderedSet, fromJS, List } = require("immutable"); | |
const { | |
createFeature, | |
createPlugin | |
} = require("@dr-kobros/broilerplate/lib/extend"); | |
const Plugin = require("workbox-webpack-plugin"); | |
const path = require("path"); | |
const workboxInjectPlugin = createPlugin(Plugin.InjectManifest)({ | |
name: () => "workboxInjectPlugin", | |
isEnabled: (env, target) => target === "client", | |
options: (env, target, paths) => { | |
return List.of( | |
fromJS({ | |
swSrc: path.resolve(paths.get("src"), "./sw.js") | |
}) | |
); | |
} | |
}); | |
const workboxFeature = createFeature({ | |
name: () => "workboxFeature", | |
loaders: () => OrderedSet.of(), | |
plugins: () => OrderedSet.of(workboxInjectPlugin) | |
}); | |
module.exports = workboxFeature; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment