mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
b304b45e3a
In development when handling the page request, we are sending the parsedUrl with the basePath stripped but not assetPrefix. As a result, when setting an assetPrefix, the chunk would 404 which causes a hard nav. It'd then recover and work correctly on subsequent navs. This applies the exact same handling we had for basePath, but for assetPrefix. Fixes #77241
31 lines
635 B
JavaScript
31 lines
635 B
JavaScript
const ASSET_PREFIX = '/custom-asset-prefix'
|
|
|
|
module.exports = {
|
|
assetPrefix: ASSET_PREFIX,
|
|
i18n: {
|
|
locales: ['en-US'],
|
|
defaultLocale: 'en-US',
|
|
},
|
|
async rewrites() {
|
|
return {
|
|
beforeFiles: [
|
|
{
|
|
source: `/:locale/${ASSET_PREFIX}/_next/:path*`,
|
|
destination: `/${ASSET_PREFIX}/_next/:path*`,
|
|
locale: false,
|
|
},
|
|
],
|
|
afterFiles: [
|
|
{
|
|
source: `/${ASSET_PREFIX}/:path*`,
|
|
destination: '/:path*',
|
|
},
|
|
{
|
|
source: '/not-custom-asset-prefix/:path*',
|
|
destination: '/:path*',
|
|
},
|
|
],
|
|
}
|
|
},
|
|
}
|