Skip to content

Commit 06879d7

Browse files
committed
switch injected file location to be first rather than last
1 parent 3dbdc45 commit 06879d7

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

packages/nextjs/src/config/webpack.ts

+5-7
Original file line numberDiff line numberDiff line change
@@ -159,22 +159,20 @@ function addFileToExistingEntryPoint(
159159
const currentEntryPoint = entryProperty[entryPointName];
160160
let newEntryPoint: EntryPointValue;
161161

162-
// We inject the user's client config file after the existing code so that the config file has access to
163-
// `publicRuntimeConfig`. See https://github.com/getsentry/sentry-javascript/issues/3485
164162
if (typeof currentEntryPoint === 'string') {
165-
newEntryPoint = [currentEntryPoint, filepath];
163+
newEntryPoint = [filepath, currentEntryPoint];
166164
} else if (Array.isArray(currentEntryPoint)) {
167-
newEntryPoint = [...currentEntryPoint, filepath];
165+
newEntryPoint = [filepath, ...currentEntryPoint];
168166
}
169167
// descriptor object (webpack 5+)
170168
else if (typeof currentEntryPoint === 'object' && 'import' in currentEntryPoint) {
171169
const currentImportValue = currentEntryPoint.import;
172-
let newImportValue: string | string[];
170+
let newImportValue;
173171

174172
if (typeof currentImportValue === 'string') {
175-
newImportValue = [currentImportValue, filepath];
173+
newImportValue = [filepath, currentImportValue];
176174
} else {
177-
newImportValue = [...currentImportValue, filepath];
175+
newImportValue = [filepath, ...currentImportValue];
178176
}
179177

180178
newEntryPoint = {

0 commit comments

Comments
 (0)