-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathpreact.config.js
More file actions
40 lines (36 loc) · 893 Bytes
/
preact.config.js
File metadata and controls
40 lines (36 loc) · 893 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
32
33
34
35
36
37
38
39
40
const preactCliSwPrecachePlugin = require('preact-cli-sw-precache');
export default (config, env, helpers) => {
config.output.publicPath = env.production ? '/io/' : '/';
config.plugins.push(
new helpers.webpack.DefinePlugin({
'process.env.PUBLIC_PATH': JSON.stringify(config.output.publicPath || '/')
})
);
const precacheConfig = {
filename: 'sw.js',
navigateFallback: 'index.html',
navigateFallbackWhitelist: [/^(?!\/__).*/],
minify: true,
stripPrefix: config.cwd,
staticFileGlobsIgnorePatterns: [
/polyfills(\..*)?\.js$/,
/\.map$/,
/push-manifest\.json$/,
/.DS_Store/,
/\.git/
],
runtimeCaching: [
{
urlPattern: /^https:\/\/res\.cloudinary\.com\//,
handler: 'fastest',
options: {
cache: {
maxEntries: 200,
name: 'items-cache'
}
}
}
]
};
return preactCliSwPrecachePlugin(config, precacheConfig);
};