aspect-build / aspect-build/rules_webpack

[Bug]: Errors when using builtin webpack plugins

Open
#83 1 comment 0 reactions 0 assignees View on GitHub
bug documentation
Dominant language
Starlark
Stars
33
Forks
20
PR merge metrics
No merged PRs in 30d

Description

### What happened?

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

```js
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](https://opencollective.com/aspect-build/)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.