|
1 | 1 | /* eslint-disable complexity */
|
2 | 2 | /* eslint-disable max-lines */
|
3 | 3 | import { getSentryRelease } from '@sentry/node';
|
4 |
| -import { arrayify, dropUndefinedKeys, escapeStringForRegex, logger } from '@sentry/utils'; |
5 |
| -import { default as SentryWebpackPlugin } from '@sentry/webpack-plugin'; |
| 4 | +import { arrayify, dropUndefinedKeys, escapeStringForRegex, loadModule, logger } from '@sentry/utils'; |
6 | 5 | import * as chalk from 'chalk';
|
7 | 6 | import * as fs from 'fs';
|
8 | 7 | import * as path from 'path';
|
@@ -313,8 +312,11 @@ export function constructWebpackConfigFunction(
|
313 | 312 | // without, the option to use `hidden-source-map` only applies to the client-side build.
|
314 | 313 | newConfig.devtool = userSentryOptions.hideSourceMaps && !isServer ? 'hidden-source-map' : 'source-map';
|
315 | 314 |
|
| 315 | + const SentryWebpackPlugin = loadModule('@sentry/webpack-plugin'); |
| 316 | + |
316 | 317 | newConfig.plugins = newConfig.plugins || [];
|
317 | 318 | newConfig.plugins.push(
|
| 319 | + // @ts-expect-error - this exists, the dynamic import just doesn't know about it |
318 | 320 | new SentryWebpackPlugin(
|
319 | 321 | getWebpackPluginOptions(buildContext, userSentryWebpackPluginOptions, userSentryOptions),
|
320 | 322 | ),
|
@@ -767,6 +769,9 @@ function shouldEnableWebpackPlugin(buildContext: BuildContext, userSentryOptions
|
767 | 769 | // architecture-specific version of the `sentry-cli` binary. If `yarn install`, `npm install`, or `npm ci` are run
|
768 | 770 | // with the `--ignore-scripts` option, this will be blocked and the missing binary will cause an error when users
|
769 | 771 | // try to build their apps.
|
| 772 | + const SentryWebpackPlugin = loadModule('@sentry/webpack-plugin'); |
| 773 | + |
| 774 | + // @ts-expect-error - this exists, the dynamic import just doesn't know it |
770 | 775 | if (!SentryWebpackPlugin.cliBinaryExists()) {
|
771 | 776 | // eslint-disable-next-line no-console
|
772 | 777 | console.error(
|
|
0 commit comments