change default _next in request path into something custom
See original GitHub issueWhat version of Next.js are you using?
12.0.4
What version of Node.js are you using?
12.22.7 / 14.17.5
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Local & Docker container
Describe the Bug
The following no longer works in Next.js 12 in combination with i18n Requests for static assets return a 404.
module.exports = {
assetPrefix: '/docs',
rewrites() {
return [
{ source: '/docs/_next/:path*', destination: '/_next/:path*' }
]
}
}
_Originally posted by @timneutkens in https://github.com/vercel/next.js/issues/5602#issuecomment-673382891_
Expected Behavior
changes default _next in request path into something custom
To Reproduce
$ yarn create next-app --typescript
next.config.js
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
i18n: {
locales: ['nl', 'de'],
defaultLocale: 'nl'
},
assetPrefix: '/docs',
rewrites() {
return [
{ source: '/docs/_next/:path*', destination: '/_next/:path*' }
]
}
}
$ yarn build
$ yarn start
Go to http://localhost:3000/, static assets are not loaded
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:9 (3 by maintainers)
Top Results From Across the Web
How to change default _next in request path into something ...
I use next@7. And after build, I run a custom server follow the document, then I see my .js file was requested by...
Read more >Setting a custom build directory - next.config.js
Set a custom build directory to use instead of the default .next directory.
Read more >Change a default URL to a custom path | Marketing Department
Change a default URL to a custom path · Click the URL path settings · Uncheck Generate automatic URL alias · In the...
Read more >Change url to default page next.js - Stack Overflow
I have a structure in the pages directory in the form index/index.jsx and I want this page to be returned by default when...
Read more >Routing - Laravel - The PHP Framework For Web Artisans
use App\Http\Controllers\UserController;. Route::get('/user', [ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Do you have any workaround for that
Seems similar to the idea to make the
/next/
URL prefix configurable.