forked from pooltogether/pooltogether-landing-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
60 lines (50 loc) · 1.54 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const chalk = require("chalk")
const path = require('path')
const withImages = require('next-images')
const webpack = require('webpack')
const _ = require('lodash')
const isProduction = process.env.NODE_ENV === 'production'
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
const nextConfig = {
future: {
webpack5: true,
strictPostcssConfiguration: true
},
inlineImageLimit: 48, // make it tiny so that it doesn't inline,
}
const allConfig =
withBundleAnalyzer(
withImages(
{
...nextConfig,
async redirects() {
return [
{
source: '/prizes',
destination: '/prizes/PT-cDAI',
permanent: true,
}
]
},
publicRuntimeConfig: {
locizeProjectId: process.env.NEXT_JS_LOCIZE_PROJECT_ID,
locizeApiKey: process.env.NEXT_JS_LOCIZE_DEV_API_KEY,
locizeVersion: process.env.NEXT_JS_LOCIZE_VERSION
},
webpack(config, options) {
// config.optimization.minimizer = []
config.mode = isProduction ? 'production' : 'development'
config.devtool = isProduction ? 'hidden-source-map' : 'eval-source-map'
var appVars = _.keys(process.env).filter(key => key.startsWith('NEXT_JS_'))
config.plugins.push(new webpack.EnvironmentPlugin(_.pick(process.env, appVars)))
return config
}
}
))
console.log('')
console.log(chalk.green('Using next.js config options:'))
console.log(allConfig)
console.log('')
module.exports = allConfig