forked from architus/archit.us
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.api.js
More file actions
48 lines (44 loc) · 1.13 KB
/
node.api.js
File metadata and controls
48 lines (44 loc) · 1.13 KB
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
45
46
47
48
const { GenerateSW } = require("workbox-webpack-plugin");
export default () => ({
webpack: config => {
// Service Worker
config.plugins.push(
new GenerateSW({
runtimeCaching: [
{
urlPattern: /img/,
handler: "CacheFirst"
},
{
urlPattern: new RegExp(
"^https://fonts.(?:googleapis|gstatic).com/(.*)"
),
handler: "CacheFirst"
},
{
urlPattern: /.*/,
handler: "NetworkFirst"
}
]
})
);
// Bundle analyzer
const args = process.argv.slice(3);
if (args.includes("--webpack-stats")) {
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
console.log("Building webpack statistics file > stats.json");
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: "disabled",
generateStatsFile: true
})
);
}
// Inline SVG loader
config.module.rules[0].oneOf.unshift({
test: /\.inline\.svg$/,
loader: "svg-inline-loader"
});
return config;
}
});