Skip to content

[Bug]: esbuild gets into infinite loop when using plugins #210

Description

@TvdW

What happened?

When using the esbuild module to build something that contains plugins, the sandbox plugin ends up in an infinite recursion. It keeps going until it eventually runs out of memory.

Version

osx, bazel 7.2.0rc1, rules_esbuild from git

How to reproduce

The bug was introduced by #160 / e39ac34

I am able to reproduce it with this minimal esbuild config:

const stylePlugin = require('esbuild-style-plugin');

module.exports = {
  plugins: [
    stylePlugin({}),
  ],
}

Any other information?

This happens because the sandbox sets otherOptions.pluginData.executedSandboxPlugin and expects it to be passed back, however if esbuild has other plugins defined it is not guaranteed that the other plugin will pass it otherOptions again (as this is not required by the esbuild plugin specification).

I've tried to fix it but without much luck (I'm not a js dev). Disabling the sandbox solves the problem but it's obviously not ideal 😄

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedAspect isn't prioritizing this, but the community could

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions