这是indexloc提供的服务,不要输入任何密码
Skip to content

Options.plugins throw error: Plugin context is not set #735

@daolou

Description

@daolou
export default defineConfig({
  // ...
  plugins: [
    {
        name: 'tsup-test',
        buildStart: () => {
          console.log('tsup-test', 'buildStart');
        },
        buildEnd(ctx) {
          console.log('tsup-test', 'buildEnd', ctx);
        },
      },
  ]
  // ...
})

I tried this config, it seem throw Error:

Error: Plugin context is not set
    at PluginContainer.getContext

Then I check source code, it real exist a logic error:

1. buildStarted will check context:

image

2. setContext method happend in runEsbuild:

image

3. buildStarted invoke before runEsbuild, while exec buildStarted, it not yet set context, so it should throw error: "Plugin context is not set"

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions