我想同时导出这两个模块,有人可以告诉我如何合并:
const path = require("path");
const withSass = require('@zeit/next-sass');
const withCSS = require('@zeit/next-css');
module.exports = {
target: "serverless",
webpack(config) {
config.resolve.modules.push(path.resolve("./"));
return config;
}
};
module.exports = withCSS(withSass());
尝试了多种关于stackoverflow的方式,但是我自己的想法不幸地没有奏效。第一个模块用于绝对路径,第二个模块用于引导。如果您有关于如何更轻松地获得结果的一般建议,我将不胜感激。
答案 0 :(得分:0)
尝试这种方式:
const withPlugins = require('next-compose-plugins');
const withCss = require('@zeit/next-css');
const withSass = require('@zeit/next-sass');
const withImages = require('next-images');
const nextConfig = {
... // webpack configs if you have
return config;
},
};
module.exports = withPlugins(
[
[withImages],
[withCss],
[
withSass, // if you have other options go this way
{
cssModules: true,
cssLoaderOptions: {
localIdentName: '[path]___[local]___[hash:base64:5]',
},
},
],
],
nextConfig,
);