Skip to content

Commit 668961c

Browse files
committed
fix(build): actually fix maybe?
1 parent c8d6982 commit 668961c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

website/next.config.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
2-
const withTypedCssModules = (webpackConfig) => {
1+
// modifies Next.js's internal webpack config to add autogenerated typings for css modules
2+
const withTypedCssModules = (config) => {
33
const cssLoaderRegex = /(?<!post)css-loader/;
44
const typingsForCssModulesLoader = {
55
loader: "@teamsupercell/typings-for-css-modules-loader",
66
options: {
77
disableLocalsExport: true,
88
verifyOnly: process.env.NODE_ENV === "production",
9-
banner: `// AUTOGENERATED FILE -- DO NOT EDIT DIRECTLY\n`,
9+
banner: `// AUTOGENERATED FILE -- DO NOT EDIT DIRECTLY`.trimStart(),
1010
},
1111
};
1212

1313
// looking for the webpack rules where `css-loader` is specified
14-
const { oneOf } = webpackConfig.module.rules.find((rule) => Array.isArray(rule.oneOf));
14+
const { oneOf } = config.module.rules.find((rule) => Array.isArray(rule.oneOf));
1515
const rules = oneOf.filter((rule) => Array.isArray(rule.use));
1616

1717
rules.forEach((rule) => {
@@ -24,9 +24,8 @@ const withTypedCssModules = (webpackConfig) => {
2424
rule.use.splice(cssLoaderIndex, 0, { ...typingsForCssModulesLoader });
2525
})
2626

27-
return webpackConfig
27+
return config;
2828
}
29-
3029

3130
/** @type {import('next').NextConfig} */
3231
module.exports = {

0 commit comments

Comments
 (0)