Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
daolou opened this issue Sep 29, 2022 · 1 comment · Fixed by #758
Closed

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

daolou opened this issue Sep 29, 2022 · 1 comment · Fixed by #758
Labels

Comments

@daolou
Copy link

daolou commented Sep 29, 2022

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2022

🎉 This issue has been resolved in version 6.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant