Skip to content

[Bug]: Errors when using builtin webpack plugins #83

@titanous

Description

@titanous

What happened?

I'm trying to use a built-in webpack plugin, for example:

const { SourceMapDevToolPlugin } = require('webpack');

module.exports = {
    devtool: false,
    plugins: [new SourceMapDevToolPlugin({})],
}

and I get one of two errors depending on whether I include webpack as a dependency in the configuration:

[webpack-cli] Error: Cannot find module 'webpack'
[webpack-cli] TypeError: The 'compilation' argument must be an instance of Compilation

Version

Development (host) and target OS/architectures:

Output of bazel --version:

bazel 6.0.0

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

rules_webpack v0.7.0

How to reproduce

Full repro workspace here of every variant I tried: https://github.com/titanous/rules_webpack_require_error

Any other information?

No response

Fund our work

  • Sponsor our open source work by donating a bug bounty

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions