11ty / eleventy-plugin-vite

A plugin to use Vite with Eleventy
134 stars 10 forks source link

Rollup config is not executed #45

Open YonatanKra opened 3 months ago

YonatanKra commented 3 months ago

I'm setting up the following rollup config:

  module.export = {
    "input": "./apps/docs/assets/bundled-scripts/live-sample.js",
    "output": {
      "dir": "./dist/apps/docs/assets/scripts/",
      "format": "cjs"
    },
    "plugins": [
      virtualPlugin,
      nodeResolve(),
      terser(),
    ]
  }

When I run rollup from command line, it generates the file as expected

When I run this inside an 11ty config like this:

    eleventyConfig.addPlugin(EleventyVitePlugin, {
        viteOptions: {
            build: {
                rollupOptions // the options imported from the config file
            }
        }
    });

Is there a reason why the rollup config won't be taken into account?

KiwiKilian commented 1 month ago

While your rollupOptions will be merged with the plugin defaults, rollupOptions.input will be overwritten by the plugin and set to the files outputted by eleventy: https://github.com/11ty/eleventy-plugin-vite/blob/main/EleventyVite.js#L58

What's the use case of your setup?