From 16f80fe797a8f0bb5cc0b14c4018360e2bf90434 Mon Sep 17 00:00:00 2001 From: Jon Espen Kvisler Date: Thu, 2 Sep 2021 07:24:52 +0200 Subject: [PATCH 1/3] Add js types to SentryWebpackPluginOptions Enables code completion in Visual Studio Code (and perhaps other editors) --- examples/with-sentry/next.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/with-sentry/next.config.js b/examples/with-sentry/next.config.js index a5aae5a75454..5ccbe6aa28ba 100644 --- a/examples/with-sentry/next.config.js +++ b/examples/with-sentry/next.config.js @@ -9,6 +9,7 @@ const moduleExports = { // Your existing module.exports } +/** @type {import('@sentry/nextjs/dist/config/types').SentryWebpackPluginOptions} */ const SentryWebpackPluginOptions = { // Additional config options for the Sentry Webpack plugin. Keep in mind that // the following options are set automatically, and overriding them is not From 17c85fa36fe6ee0dbb896d7f0c78b91434e380b3 Mon Sep 17 00:00:00 2001 From: Jon Espen Kvisler Date: Fri, 3 Sep 2021 08:01:10 +0200 Subject: [PATCH 2/3] Use partial type for SentryWebpackPluginOptions This matches the expected type in https://github.com/getsentry/sentry-javascript/blob/e71454ef781563e36c727315d1a5b59acb9e2e0a/packages/nextjs/src/config/webpack.ts#L38 --- examples/with-sentry/next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/with-sentry/next.config.js b/examples/with-sentry/next.config.js index 5ccbe6aa28ba..b07cd48eb32d 100644 --- a/examples/with-sentry/next.config.js +++ b/examples/with-sentry/next.config.js @@ -9,7 +9,7 @@ const moduleExports = { // Your existing module.exports } -/** @type {import('@sentry/nextjs/dist/config/types').SentryWebpackPluginOptions} */ +/** @type {Partial} */ const SentryWebpackPluginOptions = { // Additional config options for the Sentry Webpack plugin. Keep in mind that // the following options are set automatically, and overriding them is not From 0ea8b79f190ac87f1d29a482f297fcc36291265a Mon Sep 17 00:00:00 2001 From: Jon Espen Kvisler Date: Mon, 21 Feb 2022 11:11:12 +0100 Subject: [PATCH 3/3] inline sentry config --- examples/with-sentry/next.config.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/with-sentry/next.config.js b/examples/with-sentry/next.config.js index 5e0609062866..c5047243cc2b 100644 --- a/examples/with-sentry/next.config.js +++ b/examples/with-sentry/next.config.js @@ -9,8 +9,9 @@ const moduleExports = { // Your existing module.exports } -/** @type {Partial} */ -const sentryWebpackPluginOptions = { +// Make sure adding Sentry options is the last code to run before exporting, to +// ensure that your source maps include changes from all other Webpack plugins +module.exports = withSentryConfig(moduleExports, { // Additional config options for the Sentry Webpack plugin. Keep in mind that // the following options are set automatically, and overriding them is not // recommended: @@ -18,8 +19,4 @@ const sentryWebpackPluginOptions = { // urlPrefix, include, ignore // For all available options, see: // https://github.com/getsentry/sentry-webpack-plugin#options. -} - -// Make sure adding Sentry options is the last code to run before exporting, to -// ensure that your source maps include changes from all other Webpack plugins -module.exports = withSentryConfig(moduleExports, sentryWebpackPluginOptions) +})