-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
45 lines (42 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
45
const path = require('path')
const withPWA = require('next-pwa')
const runtimeCaching = require('next-pwa/cache')
const prod = process.env.NODE_ENV === 'production'
const nextConfig = {
pwa: {
dest: 'public',
runtimeCaching,
disable: !process.env.ENABLE_PWA && !prod,
register: false,
skipWaiting: false,
publicExcludes: ['!noprecache/**/*', '!vendor/**/*'],
},
env: {
COMMIT_SHA: process.env.VERCEL_GIT_COMMIT_SHA || null,
PKG_VERSION: require('./package.json').version,
},
webpack(config, { dev, isServer }) {
if (!dev && !isServer) {
Object.assign(config.resolve.alias, {
react: 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat',
})
}
config.module.rules.push({
test: /\.(woff|woff2|eot|ttf|gif|jpg|ico|svg|pdf)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'static/files',
},
})
config.resolve.alias['@'] = path.resolve(__dirname, './src')
config.experiments = config.experiments || {}
Object.assign(config.experiments, {
asyncWebAssembly: true,
})
return config
},
}
module.exports = withPWA(nextConfig)