Skip to content

Commit f140888

Browse files
authored
ref(nextjs): Use bundling instead of proxying to wrap pages and API routes (#6685)
1 parent 5938288 commit f140888

File tree

11 files changed

+246
-227
lines changed

11 files changed

+246
-227
lines changed

packages/nextjs/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
"access": "public"
1818
},
1919
"dependencies": {
20-
"@rollup/plugin-sucrase": "4.0.4",
21-
"@rollup/plugin-virtual": "3.0.0",
20+
"@rollup/plugin-commonjs": "24.0.0",
2221
"@sentry/core": "7.30.0",
2322
"@sentry/integrations": "7.30.0",
2423
"@sentry/node": "7.30.0",

packages/nextjs/rollup.npm.config.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ export default [
1414
),
1515
...makeNPMConfigVariants(
1616
makeBaseNPMConfig({
17-
entrypoints: [
18-
'src/config/templates/pageProxyLoaderTemplate.ts',
19-
'src/config/templates/apiProxyLoaderTemplate.ts',
20-
],
17+
entrypoints: ['src/config/templates/pageWrapperTemplate.ts', 'src/config/templates/apiWrapperTemplate.ts'],
2118

2219
packageSpecificConfig: {
2320
output: {
@@ -32,15 +29,13 @@ export default [
3229
// make it so Rollup calms down about the fact that we're combining default and named exports
3330
exports: 'named',
3431
},
35-
external: ['@sentry/nextjs', '__RESOURCE_PATH__'],
32+
external: ['@sentry/nextjs', '__SENTRY_WRAPPING_TARGET__'],
3633
},
3734
}),
3835
),
3936
...makeNPMConfigVariants(
4037
makeBaseNPMConfig({
4138
entrypoints: ['src/config/loaders/index.ts'],
42-
// Needed in order to successfully import sucrase
43-
esModuleInterop: true,
4439

4540
packageSpecificConfig: {
4641
output: {
@@ -50,7 +45,7 @@ export default [
5045
// make it so Rollup calms down about the fact that we're combining default and named exports
5146
exports: 'named',
5247
},
53-
external: ['@rollup/plugin-sucrase', 'rollup'],
48+
external: ['@rollup/plugin-commonjs', 'rollup'],
5449
},
5550
}),
5651
),
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export { default as valueInjectionLoader } from './valueInjectionLoader';
22
export { default as prefixLoader } from './prefixLoader';
3-
export { default as proxyLoader } from './proxyLoader';
3+
export { default as wrappingLoader } from './wrappingLoader';

packages/nextjs/src/config/loaders/proxyLoader.ts

-98
This file was deleted.

packages/nextjs/src/config/loaders/rollup.ts

-104
This file was deleted.

packages/nextjs/src/config/loaders/types.ts

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type webpack from 'webpack';
2+
13
export type LoaderThis<Options> = {
24
/** Path to the file being loaded */
35
resourcePath: string;
@@ -7,6 +9,12 @@ export type LoaderThis<Options> = {
79

810
// Function to add outside file used by loader to `watch` process
911
addDependency: (filepath: string) => void;
12+
13+
// Marks a loader as asynchronous
14+
async: webpack.loader.LoaderContext['async'];
15+
16+
// Return errors, code, and sourcemaps from an asynchronous loader
17+
callback: webpack.loader.LoaderContext['callback'];
1018
} & (
1119
| {
1220
// Loader options in Webpack 4

0 commit comments

Comments
 (0)