Skip to content

Commit

Permalink
Merge branch 'canary' into shu/4d3c
Browse files Browse the repository at this point in the history
  • Loading branch information
shuding authored Oct 23, 2023
2 parents 28e8aa3 + b0e3a67 commit 1ee4d08
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
26 changes: 14 additions & 12 deletions packages/next/src/build/create-compiler-aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,39 @@ interface CompilerAliases {
}

export function createWebpackAliases({
dev,
pageExtensions,
isClient,
isEdgeServer,
isNodeServer,
dev,
config,
pagesDir,
appDir,
dir,
distDir,
isClient,
reactProductionProfiling,
isNodeServer,
clientResolveRewrites,
hasRewrites,
}: {
dev: boolean
pageExtensions: string[]
isClient: boolean
isEdgeServer: boolean
isNodeServer: boolean
dev: boolean
config: NextConfigComplete
pagesDir: string | undefined
appDir: string | undefined
dir: string
distDir: string
isClient: boolean
reactProductionProfiling: boolean
isNodeServer: boolean
clientResolveRewrites: string
hasRewrites: boolean
}): CompilerAliases {
const distDir = path.join(dir, config.distDir)
const pageExtensions = config.pageExtensions
const clientResolveRewrites = require.resolve(
'../shared/lib/router/utils/resolve-rewrites'
)
const customAppAliases: CompilerAliases = {}
const customDocumentAliases: CompilerAliases = {}

// tell webpack where to look for _app and _document
// using aliases to allow falling back to the default
// version when removed or not present
if (dev) {
const nextDistPath = 'next/dist/' + (isEdgeServer ? 'esm/' : '')
customAppAliases[`${PAGES_DIR_ALIAS}/_app`] = [
Expand Down
16 changes: 3 additions & 13 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,13 +601,6 @@ export default async function getBaseWebpackConfig(
} satisfies ClientEntries)
: undefined

// tell webpack where to look for _app and _document
// using aliases to allow falling back to the default
// version when removed or not present
const clientResolveRewrites = require.resolve(
'../shared/lib/router/utils/resolve-rewrites'
)

const resolveConfig: webpack.Configuration['resolve'] = {
// Disable .mjs for node_modules bundling
extensions: isNodeServer
Expand All @@ -619,18 +612,15 @@ export default async function getBaseWebpackConfig(
...nodePathList, // Support for NODE_PATH environment variable
],
alias: createWebpackAliases({
dev,
pageExtensions,
isClient,
isEdgeServer,
isNodeServer,
dev,
config,
pagesDir,
appDir,
dir,
distDir,
isClient,
reactProductionProfiling,
isNodeServer,
clientResolveRewrites,
hasRewrites,
}),
...(isClient || isEdgeServer
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/lib/metadata/resolvers/resolve-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function resolveUrl(

// Handle relative or absolute paths
const basePath = metadataBase.pathname || ''
const joinedPath = path.join(basePath, url)
const joinedPath = path.posix.join(basePath, url)

return new URL(joinedPath, metadataBase)
}
Expand Down

0 comments on commit 1ee4d08

Please sign in to comment.