Skip to content
This repository was archived by the owner on Nov 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"node": ">= 8"
},
"dependencies": {
"@sentry/cli": "^1.74.4"
"@sentry/cli": "^1.74.4",
"webpack-sources": "^2.0.0 || ^3.0.0"
},
"devDependencies": {
"@types/webpack": "^4.41.31 || ^5.0.0",
Expand Down
15 changes: 2 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const SentryCli = require('@sentry/cli');
const path = require('path');
const util = require('util');
const { RawSource } = require('webpack-sources');

const SENTRY_LOADER = path.resolve(__dirname, 'sentry.loader.js');
const SENTRY_MODULE = path.resolve(__dirname, 'sentry-webpack.module.js');
Expand Down Expand Up @@ -75,23 +76,11 @@ function attachAfterEmitHook(compiler, callback) {
}

function attachAfterCodeGenerationHook(compiler, options) {
// This is only a problem for folks on webpack 3 and below
if (!compiler.hooks || !compiler.hooks.make) {
return;
}

let webpackSources;
try {
// eslint-disable-next-line global-require, import/no-extraneous-dependencies
webpackSources = require('webpack-sources');
} catch (_e) {
// eslint-disable-next-line no-console
console.warn(
'Coud not resolve package: webpack-sources. Skipping injection for the remote entry file.'
);
return;
}

const { RawSource } = webpackSources;
const moduleFederationPlugin =
compiler.options &&
compiler.options.plugins &&
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4616,6 +4616,11 @@ webidl-conversions@^4.0.2:
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"
integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==

"webpack-sources@^2.0.0 || ^3.0.0":
version "3.2.3"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde"
integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==

webpack-sources@^3.2.0:
version "3.2.1"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.1.tgz#251a7d9720d75ada1469ca07dbb62f3641a05b6d"
Expand Down