Created
January 5, 2022 12:38
-
-
Save kapowaz/86f4b45c8e0b9f65b01093fbe6f3eaa9 to your computer and use it in GitHub Desktop.
Use typings-for-css-modules-loader with Next.js, SCSS and CSS Modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const withSass = require('@zeit/next-sass'); | |
module.exports = withSass({ | |
webpack: (config) => { | |
const scssRule = config.module.rules.find(({ test }) => String(test) === String(/\.scss$/)); | |
if (config.mode === 'development' && config.name === 'client') { | |
scssRule.use.unshift({ | |
loader: require.resolve('@teamsupercell/typings-for-css-modules-loader'), | |
}); | |
} | |
return config; | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment