【发布时间】:2019-05-16 12:48:24
【问题描述】:
我正在尝试在我的下一个 js 项目中使用 ant design。我能够无缝地设计和开发所有东西,但是我在部署我的代码时遇到了问题,因为我无法导出。 以下是我要执行的脚本:-
/* eslint-disable */
const withCss = require('@zeit/next-css')
// fix: prevents error when .css files are required by node
if (typeof require !== 'undefined') {
require.extensions['.css'] = file => {}
}
module.exports = withCss(),{
exportPathMap: function () {
return {
'/': { page: '/' },
'/about': { page: '/about' },
'/abc': { page: '/abc'},
'/other': { page: '/other'},
'/there': { page: '/there'},
'/sample':{page:'/sample'},
'/details':{page:'/details'}
}
}
}
如果我运行 npm run next 或 npm run next build 一切正常,但如果我运行 npm run export 我在“next.config.js”中找不到“exportPathMap”。从“./pages”和 SyntaxError: Unexpected token {. 任何帮助或建议表示赞赏。谢谢。
【问题讨论】:
-
我对 next.js 不熟悉,但在函数调用或数组之类的外部使用
,似乎确实是语法错误.. -
@MoshFeu 感谢您的及时回复。您认为正确的方法应该是什么?
-
根据我在那里找到的随机资源,该对象应该是
withCss函数的参数。 spectrum.chat/next-js/general/…
标签: javascript reactjs web-deployment next.js antd