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

70 lines
1.3 KiB
JavaScript
Raw Normal View History

const { i18n } = require("./next-i18next.config")
function fixCssLoaderLocalIdent(webpackConfig) {
function innerFix(used) {
2022-06-11 03:08:49 +00:00
if (used.loader?.match?.(/.*[/]css-loader.*/)) {
2022-06-11 03:08:49 +00:00
if (used.options?.modules) {
2022-06-11 03:08:49 +00:00
if (used.options.modules.getLocalIdent) {
2022-06-11 03:08:49 +00:00
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
}
2022-05-25 14:20:22 +00:00
2022-05-29 03:00:48 +00:00
/**
* @type {import('next').NextConfig}
*/
2022-05-20 11:59:24 +00:00
const nextConfig = {
2022-06-11 03:08:49 +00:00
experimental: { images: { layoutRaw: true } },
2022-06-04 03:13:19 +00:00
reactStrictMode: true,
webpack,
2022-06-04 03:13:19 +00:00
i18n,
2022-05-20 11:59:24 +00:00
}
module.exports = nextConfig