-
Notifications
You must be signed in to change notification settings - Fork 8
/
next.config.js
44 lines (40 loc) · 1.21 KB
/
next.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 SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin');
const withBundleAnalyzer = require('@zeit/next-bundle-analyzer');
let radiksServer = process.env.RADIKS_API_SERVER || 'http://localhost:5000';
if (process.env.HEROKU_APP_NAME) {
radiksServer = `https://${process.env.HEROKU_APP_NAME}.herokuapp.com`;
}
module.exports = withBundleAnalyzer({
analyzeServer: ['server', 'both'].includes(process.env.BUNDLE_ANALYZE),
analyzeBrowser: ['browser', 'both'].includes(process.env.BUNDLE_ANALYZE),
bundleAnalyzerConfig: {
server: {
analyzerMode: 'static',
reportFilename: '../bundles/server.html',
},
browser: {
analyzerMode: 'static',
reportFilename: '../bundles/client.html',
},
},
env: {
RADIKS_API_SERVER: radiksServer,
HEROKU_APP_NAME: process.env.HEROKU_APP_NAME,
APP_ENV: process.env.NODE_ENV || 'development',
},
webpack: (config) => {
config.plugins.push(
new SWPrecacheWebpackPlugin({
verbose: true,
staticFileGlobsIgnorePatterns: [/\.next\//],
runtimeCaching: [
{
handler: 'networkFirst',
urlPattern: /^http?.*/,
},
],
})
);
return config;
},
});