11ty / eleventy-plugin-vite

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

Rollup config is not executed #45

Closed YonatanKra closed 3 months ago

YonatanKra commented 7 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 5 months 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?

KiwiKilian commented 3 months ago

Closing until further feedback. Feel free to comment if your experiencing something similar.