-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.sw.js
More file actions
31 lines (29 loc) · 793 Bytes
/
webpack.sw.js
File metadata and controls
31 lines (29 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
'use strict';
const StringReplacePlugin = require('string-replace-webpack-plugin');
const BabelMinifyPlugin = require('babel-minify-webpack-plugin');
const { IS_PRODUCTION, BABEL_MINIFY_PLUGIN_OPTIONS, devtool, output } = require('./webpack.common');
module.exports = {
entry: {
sw: './sw.js',
},
module: {
loaders: IS_PRODUCTION
? [
{
test: /sw\.js$/,
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /\.dev\./g,
replacement: () => '.prod.',
},
],
}),
},
]
: [],
},
plugins: [new StringReplacePlugin(), new BabelMinifyPlugin({}, BABEL_MINIFY_PLUGIN_OPTIONS)],
devtool,
output,
};