Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple (array) input/output options in rollupOptions #2039

Closed
olemarius opened this issue Feb 15, 2021 · 2 comments
Closed

Support multiple (array) input/output options in rollupOptions #2039

olemarius opened this issue Feb 15, 2021 · 2 comments

Comments

@olemarius
Copy link

Is your feature request related to a problem? Please describe.
I need to output two separate .html files based on my input; The first is the default index.html file, the second is a html file containing only the script tags so that I can import that file from a legacy website. Rollup's config can be an array containing multiple inputs/outputs, which is what I need, ref https://rollupjs.org/guide/en/#configuration-files

// rollup.config.js, example from rollup docs:
export default [{
  input: 'main-a.js',
  output: {
    file: 'dist/bundle-a.js',
    format: 'cjs'
  }
}, {
  input: 'main-b.js',
  output: [
    {
      file: 'dist/bundle-b1.js',
      format: 'cjs'
    },
    {
      file: 'dist/bundle-b2.js',
      format: 'es'
    }
  ]
}];

example config

import vue from '@vitejs/plugin-vue'

import rollupConfig from './rollup.config'

// https://vitejs.dev/config/
export default defineConfig({
    build: {
        rollupOptions: rollupConfig
    },
  plugins: [vue()]
})
@yyx990803
Copy link
Member

You can't because vite build runs a single Rollup build. If you want multiple builds, have multiple vite config files and run vite build -c different.config.js

@ldexterldesign
Copy link

👋 #3278 (comment)

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants