I try to build static files from Next.js, but I want to put it in subfolder of shared host or my localhost like localhost/nextweb.
I tried to find some example, but I found only putting NextJS in root.
My next.config.js looks like
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
const { ANALYZE } = process.env
module.exports = {
webpack: function (config) {
if (ANALYZE) {
config.plugins.push(new BundleAnalyzerPlugin({
analyzerMode: 'server',
analyzerPort: 8888,
openAnalyzer: true
}))
}
return config
},
exportPathMap: () => ({
"/": { page: "/" },
"/about": { page: "/about" }
}),
assetPrefix: 'http://localhost/nextweb/'
}
When I open some page, it's working, but when I click a link it shows me an network request error:
http://localhost/nextweb/_next/a5126d9c-d338-4eee-86ff-f4e6e7dbafa6/page/nextweb/about/index.js 404 not found.
but real file is contain in .../page/about/index.js not /page/nextweb/about/index.js
What should I do about this?