Skip to content

Commit c612915

Browse files
authored
chore(nextjs): Fix optional chaining linting issue (#14982)
This a strange one, maybe caused by caching? The last few PRs are failing due to these linting issues but I can't reproduce this locally on `develop` and it looks like everything passed in CI 🤷‍♂️
1 parent 8c4ae52 commit c612915

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

packages/solidstart/src/config/wrapServerEntryWithDynamicImport.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function wrapServerEntryWithDynamicImport(config: WrapServerEntryPluginOp
5353
return { id: source, moduleSideEffects: true };
5454
}
5555

56-
if (additionalImports && additionalImports.includes(source)) {
56+
if (additionalImports?.includes(source)) {
5757
// When importing additional imports like "import-in-the-middle/hook.mjs" in the returned code of the `load()` function below:
5858
// By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it
5959
// By importing "import-in-the-middle/hook.mjs", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.
@@ -70,7 +70,7 @@ export function wrapServerEntryWithDynamicImport(config: WrapServerEntryPluginOp
7070
const resolution = await this.resolve(source, importer, options);
7171

7272
// If it cannot be resolved or is external, just return it so that Rollup can display an error
73-
if (!resolution || (resolution && resolution.external)) return resolution;
73+
if (!resolution || resolution?.external) return resolution;
7474

7575
const moduleInfo = await this.load(resolution);
7676

@@ -146,23 +146,21 @@ export function extractFunctionReexportQueryParameters(query: string): { wrap: s
146146
const wrapMatch = query.match(wrapRegex);
147147
const reexportMatch = query.match(reexportRegex);
148148

149-
const wrap =
150-
wrapMatch && wrapMatch[1]
151-
? wrapMatch[1]
152-
.split(',')
153-
.filter(param => param !== '')
154-
// Sanitize, as code could be injected with another rollup plugin
155-
.map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
156-
: [];
157-
158-
const reexport =
159-
reexportMatch && reexportMatch[1]
160-
? reexportMatch[1]
161-
.split(',')
162-
.filter(param => param !== '' && param !== 'default')
163-
// Sanitize, as code could be injected with another rollup plugin
164-
.map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
165-
: [];
149+
const wrap = wrapMatch?.[1]
150+
? wrapMatch[1]
151+
.split(',')
152+
.filter(param => param !== '')
153+
// Sanitize, as code could be injected with another rollup plugin
154+
.map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
155+
: [];
156+
157+
const reexport = reexportMatch?.[1]
158+
? reexportMatch[1]
159+
.split(',')
160+
.filter(param => param !== '' && param !== 'default')
161+
// Sanitize, as code could be injected with another rollup plugin
162+
.map((str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
163+
: [];
166164

167165
return { wrap, reexport };
168166
}

0 commit comments

Comments
 (0)