Skip to content
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
This repository was archived by the owner on Oct 29, 2026. It is now read-only.

Support rspack only projects #939

Closed

Description

@samssouza

Hello, on rspack only projects when we use the plugin @sentry/webpack-plugin we get the following error during build:

Error: Cannot find module 'webpack'
  at /node_modules/@sentry/webpack-plugin/dist/cjs/index.js

Suggestion

// src/index.ts

Fall back to @rspack/core if webpack is not found or something similar.

let webpack4or5: any = {};

try {
  webpack4or5 = require("webpack");
} catch {
  try {
    webpack4or5 = require("@rspack/core");
  } catch {}
}

const BannerPlugin = webpack4or5?.BannerPlugin || webpack4or5?.default?.BannerPlugin;
const DefinePlugin = webpack4or5?.DefinePlugin || webpack4or5?.default?.DefinePlugin;

And mark both as optional peer dependencies

"peerDependenciesMeta": {
  "webpack": { "optional": true },
  "@rspack/core": { "optional": true }
}

Would that be possible?

Activity

  1. linear-code commented on Jun 4, 2026

    @linear-code
  2. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Jun 4, 2026
  3. added
    Bug
    on Jun 4, 2026
  4. self-assigned this
    on Jun 5, 2026
  5. s1gr1d commented on Jun 5, 2026

    @s1gr1d
    Member

    Hi, I created a PR for that, but we probably don't need @rspack/core as a peer dependency here as it already populates compiler.webpack.

  6. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jun 5, 2026
  7. samssouza commented on Jun 5, 2026

    @samssouza
    Author

    Hi, I created a PR for that, but we probably don't need @rspack/core as a peer dependency here as it already populates compiler.webpack.

    That's awesome thank you so much

  8. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Jun 5, 2026
  9. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bug

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions