Skip to content

Commit db79dd0

Browse files
authored
fix: don't require webpack dependency at runtime (#492)
1 parent 404ed93 commit db79dd0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/core/hooks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { resolve, posix } from 'path'
22
import merge from 'lodash.mergewith'
3-
import { DefinePlugin } from 'webpack'
43
import * as Sentry from '@sentry/node'
54
import { canInitialize, clientSentryEnabled, envToBool, serverSentryEnabled } from './utils'
65
import { resolveRelease, resolveClientOptions, resolveServerOptions } from './options'
@@ -46,9 +45,10 @@ export async function buildHook (moduleContainer, moduleOptions, logger) {
4645

4746
// Tree shake debugging code if not running in dev mode and Sentry debug option is not enabled on the client.
4847
if (!clientOptions.dev && !clientOptions.config.debug) {
48+
const webpack = await import('webpack').then(m => m.default || m)
4949
moduleContainer.options.build.plugins = moduleContainer.options.build.plugins || []
5050
moduleContainer.options.build.plugins.push(
51-
new DefinePlugin({
51+
new webpack.DefinePlugin({
5252
__SENTRY_DEBUG__: 'false',
5353
}),
5454
)

0 commit comments

Comments
 (0)