2018-11-02 22:21:59 +00:00
|
|
|
const withCSS = require('@zeit/next-css')
|
|
|
|
const withTypescript = require('@zeit/next-typescript')
|
|
|
|
|
|
|
|
/* With additional configuration on top of CSS Modules */
|
2018-12-17 16:34:32 +00:00
|
|
|
module.exports = withTypescript(
|
|
|
|
withCSS({
|
|
|
|
cssModules: true,
|
|
|
|
cssLoaderOptions: {
|
|
|
|
camelCase: true,
|
|
|
|
namedExport: true
|
|
|
|
},
|
|
|
|
webpack (config, options) {
|
|
|
|
if (!options.isServer) {
|
|
|
|
/* Using next-css */
|
|
|
|
for (let entry of options.defaultLoaders.css) {
|
|
|
|
if (entry.loader === 'css-loader') {
|
|
|
|
entry.loader = 'typings-for-css-modules-loader'
|
|
|
|
break
|
|
|
|
}
|
2018-11-02 22:21:59 +00:00
|
|
|
}
|
|
|
|
|
2018-12-17 16:34:32 +00:00
|
|
|
/* Using next-less */
|
|
|
|
/*
|
2018-11-02 22:21:59 +00:00
|
|
|
for (let entry of options.defaultLoaders.less) {
|
|
|
|
if (entry.loader === 'css-loader') {
|
|
|
|
entry.loader = 'typings-for-css-modules-loader';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2018-12-17 16:34:32 +00:00
|
|
|
/* Using next-sass */
|
|
|
|
/*
|
2018-11-02 22:21:59 +00:00
|
|
|
for (let entry of options.defaultLoaders.sass) {
|
|
|
|
if (entry.loader === 'css-loader') {
|
|
|
|
entry.loader = 'typings-for-css-modules-loader';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2018-12-17 16:34:32 +00:00
|
|
|
/* Using next-stylus */
|
|
|
|
/*
|
2018-11-02 22:21:59 +00:00
|
|
|
for (let entry of options.defaultLoaders.stylus) {
|
|
|
|
if (entry.loader === 'css-loader') {
|
|
|
|
entry.loader = 'typings-for-css-modules-loader';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
2018-12-17 16:34:32 +00:00
|
|
|
}
|
2018-11-02 22:21:59 +00:00
|
|
|
|
2018-12-17 16:34:32 +00:00
|
|
|
return config
|
|
|
|
}
|
|
|
|
})
|
|
|
|
)
|