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
executable file
·45 lines (42 loc) · 1.17 KB
/
node.api.js
File metadata and controls
executable file
·45 lines (42 loc) · 1.17 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
import { GenerateSW } from "workbox-webpack-plugin";
import transform from "./src/Build/webpack.transform";
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")) {
// eslint-disable-next-line import/no-extraneous-dependencies
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
console.log("Building webpack statistics file > stats.json");
config.plugins.push(
new BundleAnalyzerPlugin({
analyzerMode: "disabled",
generateStatsFile: true,
})
);
}
// Run common webpack transformer
return transform(config);
},
});