Skip to content

Commit 6152957

Browse files
authored
refactor(options)!: remove deprecated "webpackConfig" (#394)
BREAKING CHANGE: Configure through the `publishRelease` object instead.
1 parent 12b320c commit 6152957

File tree

4 files changed

+30
-23
lines changed

4 files changed

+30
-23
lines changed

docs/content/en/sentry/options.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,22 @@ sentry: {
186186
}
187187
```
188188

189+
Note the the module sets the following defaults when publishing is enabled:
190+
191+
```js
192+
{
193+
include: [], // automatically set at publishing time to relevant paths for the bundles that were built
194+
ignore: [
195+
'node_modules',
196+
'.nuxt/dist/client/img'
197+
],
198+
configFile: '.sentryclirc',
199+
release: '', // defaults to the value of "config.release" which can either be set manually or is determined automatically through `@sentry/cli`
200+
}
201+
```
202+
203+
- Providing custom values for `include` or `ignore` will result in provided values getting appended to default values.
204+
189205
### sourceMapStyle
190206

191207
- Type: `String`
@@ -309,14 +325,6 @@ sentry: {
309325
- Default: `{}`
310326
- Specified keys will override common Sentry options for client sentry plugin
311327
312-
### webpackConfig
313-
314-
- Deprecated - use `publishRelease` instead.
315-
- Type: `Object`
316-
- Default: Refer to `module.js` since defaults include various options that also change dynamically based on other options.
317-
- Only has effect when `publishRelease = true`
318-
- Options passed to `@sentry/webpack-plugin`. See documentation at https://github.com/getsentry/sentry-webpack-plugin/blob/master/README.md
319-
320328
### requestHandlerConfig
321329
322330
- Type: `Object`

lib/core/hooks.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,9 @@ export async function webpackConfigHook (moduleContainer, webpackConfigs, option
202202
publishRelease.urlPrefix = publicPath.startsWith('/') ? `~${publicPath}` : publicPath
203203
}
204204

205-
if (typeof publishRelease.include === 'string') {
206-
publishRelease.include = [publishRelease.include]
205+
if (!Array.isArray(publishRelease.include)) {
206+
const { include } = publishRelease
207+
publishRelease.include = [...(include ? [include] : [])]
207208
}
208209

209210
const { buildDir } = moduleContainer.options

lib/module.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -48,29 +48,29 @@ export default function SentryModule (moduleOptions) {
4848
},
4949
serverConfig: {},
5050
clientConfig: {},
51-
webpackConfig: {
52-
include: [],
53-
ignore: [
54-
'node_modules',
55-
'.nuxt/dist/client/img'
56-
],
57-
configFile: '.sentryclirc'
58-
},
5951
requestHandlerConfig: {}
6052
}
6153

54+
/** @type {import('@sentry/webpack-plugin').SentryCliPluginOptions} */
55+
const defaultsPublishRelease = {
56+
include: [],
57+
ignore: [
58+
'node_modules',
59+
'.nuxt/dist/client/img'
60+
],
61+
configFile: '.sentryclirc'
62+
}
63+
6264
const topLevelOptions = this.options.sentry || {}
6365
const options = /** @type {import('../types/sentry').ResolvedModuleConfiguration} */(
6466
merge({}, defaults, topLevelOptions, moduleOptions, mergeWithCustomizer)
6567
)
6668

6769
if (options.publishRelease) {
68-
const merged = merge(options.webpackConfig, options.publishRelease, mergeWithCustomizer)
70+
const merged = merge(defaultsPublishRelease, options.publishRelease, mergeWithCustomizer)
6971
options.publishRelease = merged
7072
}
7173

72-
options.webpackConfig = {}
73-
7474
if (serverSentryEnabled(options)) {
7575
// @ts-ignore
7676
this.nuxt.hook('render:setupMiddleware', app => app.use(SentryHandlers.requestHandler(options.requestHandlerConfig)))

types/sentry.d.ts

-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ export interface ModuleConfiguration {
6868
serverConfig?: SentryOptions
6969
serverIntegrations?: IntegrationsConfiguration
7070
sourceMapStyle?: WebpackOptions.Devtool
71-
/** @deprecated Use `publishRelease` instead. */
72-
webpackConfig?: Partial<SentryCliPluginOptions>
7371
requestHandlerConfig?: Handlers.RequestHandlerOptions
7472
}
7573

0 commit comments

Comments
 (0)