-
Notifications
You must be signed in to change notification settings - Fork 58
/
pwa.config.js
44 lines (41 loc) · 1.11 KB
/
pwa.config.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
const { InjectManifest } = require("workbox-webpack-plugin");
const stylusLoader = require("stylus-loader");
const { join } = require("path");
exports.webpack = function(config, env) {
// Add module aliases
const src = config.context;
config.resolve.alias["@styles"] = join(src, "styles");
config.resolve.alias["@js"] = join(src, "js");
config.resolve.alias["@store"] = join(src, "store");
config.devServer.host = "0.0.0.0";
// Add Workbox plugin
config.plugins.push(
new InjectManifest({
swSrc: join(src, "sw.js"),
})
);
config.module.rules.forEach(({ test, use }) => {
if ((test.test(".styl") || test.test(".stylus")) && Array.isArray(use)) {
use.forEach((loader) => {
if (loader.loader === "stylus-loader") {
loader.options.import = [
join(src, "styles/theme/index.styl"),
join(src, "styles/mixins.styl"),
];
} else loader;
});
}
});
};
exports.brotli = {
cache: true,
threshold: 0,
minRatio: 0.8,
compressionOptions: {
quality: 11,
size_hint: 0,
lgblock: 0,
lgwin: 22,
mode: 0,
},
};