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

The buildEnd hook has the different behavior in vite(rollup) and webpack. #38

Open
2nthony opened this issue Nov 3, 2021 · 2 comments

Comments

@2nthony
Copy link
Contributor

2nthony commented Nov 3, 2021

Here is my case:

I writing a plugin that will generate a file when bundler completed. My expect is:

dist/
- chunks.js
- index.html
- myfile.txt <- 👈 here

In webpack output is what am I expected, but in vite is NOT.

I do a little hooks comparison of rollup and webpack, I found the writeBundle, generateBundle is similar to webpack's compiler.hooks.done.

So my current solution is use writeBundle for vite.

vite: {
  async writeBundle(options) {
    const p = options.dir
    if (!p) return
    await writeVersionFile(p)
  }
}
@JerryWu1234
Copy link

Could you provide a duplicate?

@2nthony
Copy link
Contributor Author

2nthony commented Mar 20, 2023

I am not sure for now, because it is almost a year and a half ago issue. thanks for the ask.

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

No branches or pull requests

2 participants