Commit e01eb0e0 authored by Janka Uryga's avatar Janka Uryga

revert resource->pattern change

parent b0a97c16
...@@ -2869,14 +2869,12 @@ function getNextRootParamsRules({ ...@@ -2869,14 +2869,12 @@ function getNextRootParamsRules({
appDir: string | undefined appDir: string | undefined
pageExtensions: string[] pageExtensions: string[]
}): webpack.RuleSetRule[] { }): webpack.RuleSetRule[] {
// Match resolved import of 'next/root-params'. // Match resolved import of 'next/root-params'
// Use a regex (not an absolute path) so it works in isolated CI environments const nextRootParamsModule = path.join(NEXT_PROJECT_ROOT, 'root-params.js')
// where the resolved path differs from the local build.
const nextRootParamsModuleTest = /[\\/]next[\\/]root-params\.js$/
const createInvalidImportRule = (message: string) => { const createInvalidImportRule = (message: string) => {
return { return {
test: nextRootParamsModuleTest, resource: nextRootParamsModule,
loader: 'next-invalid-import-error-loader', loader: 'next-invalid-import-error-loader',
options: { options: {
message, message,
...@@ -2909,7 +2907,7 @@ function getNextRootParamsRules({ ...@@ -2909,7 +2907,7 @@ function getNextRootParamsRules({
"'next/root-params' cannot be imported from a Client Component module. It should only be used from a Server Component." "'next/root-params' cannot be imported from a Client Component module. It should only be used from a Server Component."
) )
const invalidNonAppServerImportRule = { const invalidNonAppServerImportRule = {
test: nextRootParamsModuleTest, resource: nextRootParamsModule,
loader: 'next-invalid-import-error-loader', loader: 'next-invalid-import-error-loader',
issuerLayer: { issuerLayer: {
or: [WEBPACK_LAYERS.instrument, WEBPACK_LAYERS.middleware], or: [WEBPACK_LAYERS.instrument, WEBPACK_LAYERS.middleware],
...@@ -2929,7 +2927,7 @@ function getNextRootParamsRules({ ...@@ -2929,7 +2927,7 @@ function getNextRootParamsRules({
oneOf: [ oneOf: [
invalidNonAppServerImportRule, invalidNonAppServerImportRule,
{ {
test: nextRootParamsModuleTest, resource: nextRootParamsModule,
issuerLayer: shouldUseReactServerCondition as ( issuerLayer: shouldUseReactServerCondition as (
layer: string layer: string
) => boolean, ) => boolean,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment