evanw / evanw/esbuild

Throwing an error within a plugin does not stop the build

Open
#3,752 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
40.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

# Details

When creating a plugin, throwing an error inside it won't stop the build, it will just cause it to timeout.

# How to reproduce

I didn't know how to create a repro on the playground for a plugin, so I am pasting the code of the plugin here:

```
import { Plugin, PluginBuild } from 'esbuild';

export const moduleExportsPlugin = (): Plugin => ({
name: 'module-exports',
setup(build: PluginBuild) {
build.onEnd(_result => {
throw new Error('module.exports already exists, unknown use case');
});
},
});
```

# Versions

It seems a regression, in v0.16.x It worked fine, since 0.17.x it causes the unexpected behaviour

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.