【发布时间】:2019-12-19 12:13:53
【问题描述】:
错误:
No "exportPathMap" found in "next.config.js". Generating map from "./pages"
但我确实有基于official docs 的exportPathMap:
我的next.config.js 包含:
const withCss = require("@zeit/next-css");
const withSass = require("@zeit/next-sass");
const withTM = require("next-transpile-modules");
module.exports = {
exportPathMap: async function(
defaultPathMap,
{ dev, dir, outDir, distDir, buildId }
) {
return {
"/": { page: "/" },
"/menu": { page: "/menu" },
"/about": { page: "/about" }
};
}
};
module.exports = withCss({
cssModules: true
});
module.exports = withSass(
withTM({
transpileModules: ["react-bulma-components"],
sassLoaderOptions: {
includePaths: ["./components"]
}
})
);
我也尝试过删除默认映射:
module.exports = {
exportPathMap: async function() {
return {
"/": { page: "/" },
"/menu": { page: "/menu" },
"/about": { page: "/about" }
};
}
};
根据我的研究,除了将其移动到withCss() 中之外:
module.exports = withCss({
exportPathMap: async function() {
return {
"/": { page: "/" },
"/menu": { page: "/menu" },
"/about": { page: "/about" }
};
}
});
withSass() 和 withCss() 的两个导出似乎可以正常工作,
我做错了什么?
编辑:
我的next.config.js 位于项目根目录中,如果您想知道的话。
【问题讨论】:
标签: javascript next.js