-
Notifications
You must be signed in to change notification settings - Fork 18
/
next.config.js
34 lines (28 loc) · 1.05 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
/** @type {import('next').NextConfig} */
const path = require('node:path')
const withVideos = require('next-videos')
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 = [withVideos]
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