Skip to content

Commit

Permalink
fix: don't require webpack dependency at runtime (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl authored Jan 25, 2023
1 parent 404ed93 commit db79dd0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/core/hooks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { resolve, posix } from 'path'
import merge from 'lodash.mergewith'
import { DefinePlugin } from 'webpack'
import * as Sentry from '@sentry/node'
import { canInitialize, clientSentryEnabled, envToBool, serverSentryEnabled } from './utils'
import { resolveRelease, resolveClientOptions, resolveServerOptions } from './options'
Expand Down Expand Up @@ -46,9 +45,10 @@ export async function buildHook (moduleContainer, moduleOptions, logger) {

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

0 comments on commit db79dd0

Please sign in to comment.