Skip to content

Commit 0e4b755

Browse files
committed
stop including basePath in urlPrefix
1 parent 88105c4 commit 0e4b755

File tree

2 files changed

+1
-94
lines changed

2 files changed

+1
-94
lines changed

packages/nextjs/src/config/webpack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ export function getWebpackPluginOptions(
487487
const isWebpack5 = webpack.version.startsWith('5');
488488
const isServerless = userNextConfig.target === 'experimental-serverless-trace';
489489
const hasSentryProperties = fs.existsSync(path.resolve(projectDir, 'sentry.properties'));
490-
const urlPrefix = userNextConfig.basePath ? `~${userNextConfig.basePath}/_next` : '~/_next';
490+
const urlPrefix = '~/_next';
491491

492492
const serverInclude = isServerless
493493
? [{ paths: [`${distDirAbsPath}/serverless/`], urlPrefix: `${urlPrefix}/serverless` }]

packages/nextjs/test/config/webpack/sentryWebpackPlugin.test.ts

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -202,99 +202,6 @@ describe('Sentry webpack plugin config', () => {
202202
});
203203
});
204204

205-
describe("Sentry webpack plugin `include` option with basePath filled on next's config", () => {
206-
const exportedNextConfigWithBasePath = {
207-
...exportedNextConfig,
208-
basePath: '/city-park',
209-
};
210-
211-
it('has the correct value when building client bundles', async () => {
212-
const buildContext = getBuildContext('client', exportedNextConfigWithBasePath);
213-
const finalWebpackConfig = await materializeFinalWebpackConfig({
214-
exportedNextConfig: exportedNextConfigWithBasePath,
215-
incomingWebpackConfig: clientWebpackConfig,
216-
incomingWebpackBuildContext: buildContext,
217-
});
218-
219-
const sentryWebpackPluginInstance = findWebpackPlugin(
220-
finalWebpackConfig,
221-
'SentryCliPlugin',
222-
) as SentryWebpackPlugin;
223-
224-
expect(sentryWebpackPluginInstance.options.include).toEqual([
225-
{
226-
paths: [`${buildContext.dir}/.next/static/chunks/pages`],
227-
urlPrefix: '~/city-park/_next/static/chunks/pages',
228-
},
229-
]);
230-
});
231-
232-
it('has the correct value when building serverless server bundles', async () => {
233-
const exportedNextConfigServerless = {
234-
...exportedNextConfigWithBasePath,
235-
target: 'experimental-serverless-trace' as const,
236-
};
237-
const buildContext = getBuildContext('server', exportedNextConfigServerless);
238-
239-
const finalWebpackConfig = await materializeFinalWebpackConfig({
240-
exportedNextConfig: exportedNextConfigServerless,
241-
incomingWebpackConfig: serverWebpackConfig,
242-
incomingWebpackBuildContext: buildContext,
243-
});
244-
245-
const sentryWebpackPluginInstance = findWebpackPlugin(
246-
finalWebpackConfig,
247-
'SentryCliPlugin',
248-
) as SentryWebpackPlugin;
249-
250-
expect(sentryWebpackPluginInstance.options.include).toEqual([
251-
{ paths: [`${buildContext.dir}/.next/serverless/`], urlPrefix: '~/city-park/_next/serverless' },
252-
]);
253-
});
254-
255-
it('has the correct value when building serverful server bundles using webpack 4', async () => {
256-
const serverBuildContextWebpack4 = getBuildContext('server', exportedNextConfigWithBasePath);
257-
serverBuildContextWebpack4.webpack.version = '4.15.13';
258-
259-
const finalWebpackConfig = await materializeFinalWebpackConfig({
260-
exportedNextConfig: exportedNextConfigWithBasePath,
261-
incomingWebpackConfig: serverWebpackConfig,
262-
incomingWebpackBuildContext: serverBuildContextWebpack4,
263-
});
264-
265-
const sentryWebpackPluginInstance = findWebpackPlugin(
266-
finalWebpackConfig,
267-
'SentryCliPlugin',
268-
) as SentryWebpackPlugin;
269-
270-
expect(sentryWebpackPluginInstance.options.include).toEqual([
271-
{
272-
paths: [`${serverBuildContextWebpack4.dir}/.next/server/pages/`],
273-
urlPrefix: '~/city-park/_next/server/pages',
274-
},
275-
]);
276-
});
277-
278-
it('has the correct value when building serverful server bundles using webpack 5', async () => {
279-
const buildContext = getBuildContext('server', exportedNextConfigWithBasePath);
280-
const finalWebpackConfig = await materializeFinalWebpackConfig({
281-
exportedNextConfig: exportedNextConfigWithBasePath,
282-
incomingWebpackConfig: serverWebpackConfig,
283-
incomingWebpackBuildContext: buildContext,
284-
});
285-
286-
const sentryWebpackPluginInstance = findWebpackPlugin(
287-
finalWebpackConfig,
288-
'SentryCliPlugin',
289-
) as SentryWebpackPlugin;
290-
291-
expect(sentryWebpackPluginInstance.options.include).toEqual([
292-
{ paths: [`${buildContext.dir}/.next/server/pages/`], urlPrefix: '~/city-park/_next/server/pages' },
293-
{ paths: [`${buildContext.dir}/.next/server/chunks/`], urlPrefix: '~/city-park/_next/server/chunks' },
294-
]);
295-
});
296-
});
297-
298205
describe('SentryWebpackPlugin enablement', () => {
299206
let processEnvBackup: typeof process.env;
300207

0 commit comments

Comments
 (0)