-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnext.config.js
More file actions
45 lines (41 loc) · 1.07 KB
/
next.config.js
File metadata and controls
45 lines (41 loc) · 1.07 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
const { InjectManifest } = require('workbox-webpack-plugin');
const { join } = require('path');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
env: {
// Pass dev mode to the client.
DEV: process.env.NODE_ENV !== 'production',
},
webpack: (config, { isServer, dev }) => {
config.module.rules.push({
test: /\.jsonld$/,
type: 'json',
});
if (!isServer && !dev) {
// Copy the public files so they are picked up by the manifest.
config.plugins.push(new CopyPlugin({
patterns: [
{
from: 'public',
to: 'public',
},
],
}));
config.plugins.push(new InjectManifest({
swSrc: join(__dirname, 'sw.js'),
swDest: join(__dirname, 'public', 'sw.js'),
exclude: [
'react-loadable-manifest.json',
'build-manifest.json',
'public/sw.js',
/\.map$/,
],
modifyURLPrefix: {
'static/': '_next/static/',
'public/': '/',
},
}));
}
return config;
},
};