-
Notifications
You must be signed in to change notification settings - Fork 1
/
next.config.js
33 lines (27 loc) · 1020 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
/** @type {import('next').NextConfig} */
const path = require('node:path')
const nextConfig = {
output: process.env.OUTPUT,
assetPrefix: process.env.NEXT_PUBLIC_ASSET_PREFIX || undefined,
trailingSlash: true,
reactStrictMode: false,
sassOptions: { includePaths: [path.join(__dirname, 'src/styles')] },
webpack(config) {
config.module.rules.push(
{ test: /\.svg$/iu, use: [{ loader: '@svgr/webpack' }] },
{ test: /\.(glb|gltf|bin|fbx|hdr|exr|woff2|riv|wasm)$/iu, type: 'asset/resource' },
{ test: /\.(glsl|hlsl|vert|frag)$/iu, type: 'asset/source' }
)
return config
}
}
const nextPlugins = []
if (process.env.BUNDLE_ANALYZE === 'true') {
const withBundleAnalyzer = require('@next/bundle-analyzer')({ enabled: true })
nextPlugins.push(withBundleAnalyzer)
}
const finalConfig = nextPlugins.reduce((config, plugin) => {
if (typeof plugin === 'function') return plugin(config)
return plugin[0]({ ...config, ...plugin[1] })
}, nextConfig)
module.exports = finalConfig