File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
packages/nextjs/src/config Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -679,6 +679,8 @@ function addRewriteFramesLoader(
679
679
target : 'server' | 'client' ,
680
680
userNextConfig : NextConfigObject ,
681
681
) : void {
682
+ // Nextjs will use `basePath` in place of `assetPrefix` if it's defined but `assetPrefix` is not
683
+ const assetPrefix = userNextConfig . assetPrefix || userNextConfig . basePath || '' ;
682
684
const replacements = {
683
685
server : [
684
686
[
@@ -693,9 +695,7 @@ function addRewriteFramesLoader(
693
695
'__ASSET_PREFIX_PATH__' ,
694
696
// Get the path part of `assetPrefix`, minus any trailing slash. (We use a placeholder for the origin if
695
697
// `assetPreix` doesn't include one. Since we only care about the path, it doesn't matter what it is.)
696
- userNextConfig . assetPrefix
697
- ? new URL ( userNextConfig . assetPrefix , 'http://dogs.are.great' ) . pathname . replace ( / \/ $ / , '' )
698
- : '' ,
698
+ assetPrefix ? new URL ( assetPrefix , 'http://dogs.are.great' ) . pathname . replace ( / \/ $ / , '' ) : '' ,
699
699
] ,
700
700
] ,
701
701
} ;
You can’t perform that action at this time.
0 commit comments