Skip to content

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

Open

Description

@2nthony

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)
  }
}

Activity

  1. JerryWu1234 commented on Mar 20, 2023

    @JerryWu1234

    Could you provide a duplicate?

  2. 2nthony commented on Mar 20, 2023

    @2nthony
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions