Source:  Twitter logo

I need to run an operation in a custom plugin on buildEnd [a roll-up plugin build hook]

buildEnd

Called when rollup has finished bundling, but before generate or write is called; you can also return a Promise. If an error occurred during the build, it is passed on to this hook.

In svelte.config.js file, I have something very close to the following snippet but it won't trigger on buildEnd

/** @type {import('@sveltejs/kit').Config} */
const config = {
  preprocess: [
    preprocess(),
  ],
  kit: {
    floc: true,
    vite: {
      esbuild: {
        target: 'node16',
      },
      optimizeDeps: {
        exclude: [...],
      },
      plugins: [
        {
          async buildEnd() {
            // ...do something on buildEnd: doesn't work!
          },
          async buildStart() {
            // ...do something on buildStart: works!
          }
        }
      ],
    },
  },
}

Is there something I'm not doing right?

Copyright © 2022 QueryThreads

All content on Query Threads is licensed under the Creative Commons Attribution-ShareAlike 3.0 license (CC BY-SA 3.0).