I want to deploy on server with specify subpath url #13178
Unanswered
teeraphong
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I follow with this "https://stackoverflow.com/questions/60452054/nextjs-deploy-to-a-specific-url-path"
I config 'next.config.js' with this code
`const nextBuildId = require('next-build-id')
const isProd = process.env.NODE_ENV === 'production'
// Enable importing of css stylesheets
const withCSS = require("@zeit/next-css")
const withImages = require('next-images')
/*
*/
function getBasePath() {
const basePath = isProd ? '/purchases/' : ''
console.log('process.env', process.env)
console.log('process.env.BASE_PATH', process.env.BASE_PATH)
console.log("getBasePath() : isProd = " + isProd)
console.log("getBasePath() : basePath = " + basePath)
return basePath
}
module.exports = withCSS(withImages({
generateBuildId: () => {
if (process.env.SOURCE_VERSION) {
return
${process.env.SOURCE_VERSION}
}
else {
return nextBuildId({ dir: __dirname })
}
},
assetPrefix: getBasePath(),
publicRuntimeConfig: {
basePath: getBasePath(),
},
}));`
and I built success on the server, but when access to URL found 404 error all URL
sample pattern URL
Could you help me with this issue?
Beta Was this translation helpful? Give feedback.
All reactions