Search code examples
svelterolluprollupjs

How to specify the path of index.html in Rollup config for Svelte


I am using the default Rollup config as my bundler for Svelte, but I want to use a different path for the bundle files and index.html

I can successfully change the path for the bundle files with this:

export default {
  input: "src/main.ts",
  output: {
    sourcemap: true,
    format: "iife",
    name: "app",
    file: "../static/build/bundle.js",
}, 

But it still looks for the index.html file in the original path. I would like to add that into the static folder as well, just like the build files.

How can I configure rollup to specify the path of the single index.html file?


Solution

  • In the sveltejs/template the build config does not deal with the html file, you can simply manually move it to where you want it to be. That said, you could use the copy plugin for rollup to copy files during build.