Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next-rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
},
"types": "index.d.ts",
"dependencies": {
"@rspack/core": "1.5.0"
"@next/rspack-core": "1.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/next-rspack/rspack-core.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('@rspack/core')
module.exports = require('@next/rspack-core')
15 changes: 13 additions & 2 deletions packages/next/src/build/webpack-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ import getWebpackBundler from '../shared/lib/get-webpack-bundler'
import type { NextBuildContext } from './build-context'
import type { RootParamsLoaderOpts } from './webpack/loaders/next-root-params-loader'
import type { InvalidImportLoaderOpts } from './webpack/loaders/next-invalid-import-error-loader'
import { defaultOverrides } from '../server/require-hook'

type ExcludesFalse = <T>(x: T | false) => x is T
type ClientEntries = {
Expand Down Expand Up @@ -966,7 +967,8 @@ export default async function getBaseWebpackConfig(
...(isNodeServer ? { externalsPresets: { node: true } } : {}),
// @ts-ignore
externals:
isClient || isEdgeServer
!isRspack &&
(isClient || isEdgeServer
? // make sure importing "next" is handled gracefully for client
// bundles in case a user imported types and it wasn't removed
// TODO: should we warn/error for this instead?
Expand Down Expand Up @@ -1038,7 +1040,7 @@ export default async function getBaseWebpackConfig(
})
}
),
],
]),

optimization: {
emitOnErrors: !dev,
Expand Down Expand Up @@ -2173,6 +2175,15 @@ export default async function getBaseWebpackConfig(
compilerType,
...config.experimental.slowModuleDetection!,
}),
isRspack &&
new (getRspackCore().NextExternalsPlugin)({
compilerType,
config,
optOutBundlingPackageRegex,
finalTranspilePackages,
dir,
defaultOverrides,
}),
].filter(Boolean as any as ExcludesFalse),
}

Expand Down
Loading
Loading