【发布时间】:2020-04-13 23:06:14
【问题描述】:
我使用 next.js 和 reactjs 完成了一个项目。我已经将 next.js 与 reactjs 一起用于 SSR。
现在的问题是我无法构建项目。如果我构建(next build,next export),生成的 index.html 只显示第一页,其他页面链接不起作用。如何构建项目并生成文件。有没有可能。
我有一个 linux 共享主机。 next.js 是否适用于 linux 共享主机。请指导我完成。我是 next.js 的新手。
package.json
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"export": "next export",
"start": "next start"
},
"dependencies": {
"next": "9.1.6",
"react": "16.12.0",
"react-dom": "16.12.0"
}
}
next.config.js
module.exports = {
exportTrailingSlash: true,
exportPathMap: function() {
return {
'/': { page: '/' }
};
}
};
【问题讨论】: