mirror of
https://github.com/kremalicious/ipfs.git
synced 2024-11-21 09:17:05 +01:00
config refactor
This commit is contained in:
parent
bb65ade4da
commit
2c98082c1c
@ -1,30 +1,23 @@
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const withSvgr = (nextConfig = {}, nextComposePlugins = {}) => {
|
||||
return Object.assign({}, nextConfig, {
|
||||
webpack(config, options) {
|
||||
module.exports = (phase, { defaultConfig }) => {
|
||||
/**
|
||||
* @type {import('next').NextConfig}
|
||||
*/
|
||||
const nextConfig = {
|
||||
webpack: (config, options) => {
|
||||
config.module.rules.push({
|
||||
test: /\.svg$/,
|
||||
use: [
|
||||
{
|
||||
loader: '@svgr/webpack',
|
||||
options: {
|
||||
icon: true
|
||||
}
|
||||
}
|
||||
]
|
||||
use: [{ loader: '@svgr/webpack', options: { icon: true } }]
|
||||
})
|
||||
return typeof defaultConfig.webpack === 'function'
|
||||
? defaultConfig.webpack(config, options)
|
||||
: config
|
||||
},
|
||||
bundleAnalyzer: () =>
|
||||
require('@next/bundle-analyzer')({
|
||||
enabled: process.env.ANALYZE === 'true'
|
||||
}),
|
||||
reactStrictMode: true
|
||||
}
|
||||
|
||||
if (typeof nextConfig.webpack === 'function') {
|
||||
return nextConfig.webpack(config, options)
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
})
|
||||
return nextConfig
|
||||
}
|
||||
|
||||
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
||||
enabled: process.env.ANALYZE === 'true'
|
||||
})
|
||||
|
||||
module.exports = withSvgr(withBundleAnalyzer())
|
||||
|
Loading…
Reference in New Issue
Block a user