Rewrite next.config.js doesn't work
See original GitHub issueVerify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
This setup just doesn’t work. I need to create a React /app to point to a react application that is still being migrated. but it just doesn’t work
async rewrites() {
return {
fallback: [
{
source: '/reactjs',
destination: `https://reactjs-micro-frontend-base.vercel.app/reactjs`,
},
{
source: '/reactjs/:path*',
destination: `https://reactjs-micro-frontend-base.vercel.app/reactjs/:path*`,
},
]
}
},
this configuration below works, but I lose my [slug].tsx from my main pages
async rewrites() {
return {
fallback: [
{
source: '/:path*',
destination: `https://reactjs-micro-frontend-base.vercel.app/:path*`,
},
]
}
},
I’m using nextjs to get id and slug params via mywebsite.com/SLUG and I need to use mywebsite.com/reactjs to point to my app in REACTJS.
I can’t create a redirect because it would lose the url mywebsite.com/reactjs.
I already bought the federation MF and SRR module, but it doesn’t solve my problem, because it only imports react components and not an entire application with routes, context and all the features that already exist in reactjs ready.
They are being migrated little by little.
The error it presents is that the reactjs source files were not found on mywebsite.com as they are in another path. the second setting returns reactjs app the first returns blank page
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
Next.config.js configuration doesn’t work perfectly or there is no explanation for my problem.
Expected Behavior
Direct to application in reactjs according to the second configuration that works perfectly
Link to reproduction
I do not have
To Reproduce
Link to vercel application https://home-micro-frontend-base.vercel.app
Link Github configuration apps https://github.com/EmersonGarrido/micro-frontend-base
Link Github ReactJS APP https://github.com/EmersonGarrido/reactjs-base
Issue Analytics
- State:
- Created a year ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
This issue has been automatically closed because it wasn’t verified against next@canary. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.