-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nextjs): Add SDK to serverside app
directory
#6927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f36d418
ffc8aa0
852a03e
668deb0
5cccece
e214d97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
// mock helper functions not tested directly in this file | ||
import '../mocks'; | ||
|
||
import { SentryWebpackPlugin } from '../../../src/config/webpack'; | ||
import { default as SentryWebpackPlugin } from '@sentry/webpack-plugin'; | ||
|
||
import { | ||
CLIENT_SDK_CONFIG_FILE, | ||
clientBuildContext, | ||
|
@@ -138,7 +139,7 @@ describe('constructWebpackConfigFunction()', () => { | |
); | ||
}); | ||
|
||
it('injects user config file into `_app` in client bundle but not in server bundle', async () => { | ||
it('injects user config file into `_app` in server bundle but not in client bundle', async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why did this condition flip? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It basically doesn't matter where we inject what. To clean things up a bit I decided we should inject the server SDK in the I assume this test just verified that we do not accidentally mess this up. |
||
const finalServerWebpackConfig = await materializeFinalWebpackConfig({ | ||
exportedNextConfig, | ||
incomingWebpackConfig: serverWebpackConfig, | ||
|
@@ -152,12 +153,12 @@ describe('constructWebpackConfigFunction()', () => { | |
|
||
expect(finalServerWebpackConfig.entry).toEqual( | ||
expect.objectContaining({ | ||
'pages/_app': expect.not.arrayContaining([serverConfigFilePath]), | ||
'pages/_app': expect.arrayContaining([serverConfigFilePath]), | ||
}), | ||
); | ||
expect(finalClientWebpackConfig.entry).toEqual( | ||
expect.objectContaining({ | ||
'pages/_app': expect.arrayContaining([clientConfigFilePath]), | ||
'pages/_app': expect.not.arrayContaining([clientConfigFilePath]), | ||
}), | ||
); | ||
}); | ||
|
@@ -232,9 +233,9 @@ describe('constructWebpackConfigFunction()', () => { | |
}); | ||
|
||
expect(finalWebpackConfig.entry).toEqual({ | ||
main: './src/index.ts', | ||
main: ['./sentry.client.config.js', './src/index.ts'], | ||
// only _app has config file injected | ||
'pages/_app': [clientConfigFilePath, 'next-client-pages-loader?page=%2F_app'], | ||
'pages/_app': 'next-client-pages-loader?page=%2F_app', | ||
'pages/_error': 'next-client-pages-loader?page=%2F_error', | ||
'pages/sniffTour': ['./node_modules/smellOVision/index.js', 'private-next-pages/sniffTour.js'], | ||
'pages/simulator/leaderboard': { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: can we move the
The webpack plugin's release injection breaks the
appdirectory
comment down here?