forked from pooltogether/pooltogether-community-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
41 lines (31 loc) · 1009 Bytes
/
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
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 = {
inlineImageLimit: 48, // make it tiny so that it doesn't inline,
}
const allConfig =
withBundleAnalyzer(
withImages(
{
...nextConfig,
webpack(config, options) {
config.optimization.minimizer = []
config.mode = isProduction ? 'production' : 'development'
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