1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-22 22:54:22 +00:00
festa/next.config.js

69 lines
1.3 KiB
JavaScript

const { i18n } = require("./next-i18next.config")
function fixCssLoaderLocalIdent(webpackConfig) {
function innerFix(used) {
if (used.loader?.match?.(/.*[/]css-loader.*/)) {
if (used.options?.modules) {
if (used.options.modules.getLocalIdent) {
used.options.modules.getLocalIdent = (context, localIdentName, localName) => `festa__${localName}`
}
}
}
return used
}
webpackConfig.module.rules = webpackConfig.module.rules.map(rule => {
if (rule.oneOf) {
rule.oneOf = rule.oneOf.map(one => {
if (one.use === undefined) {
}
else if (Array.isArray(one.use)) {
one.use = one.use.map(innerFix)
}
else {
one.use = innerFix(one.use)
}
return one
})
}
return rule
})
return webpackConfig
}
function webpack(config) {
config = fixCssLoaderLocalIdent(config)
return config
}
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
experimental: { images: { layoutRaw: true } },
reactStrictMode: true,
webpack,
i18n,
}
module.exports = nextConfig