0

I can export Multiple builds with vite, but they both exclude external libraries from the rollupOptions. I need

  • an ES build using the EXTERNAL option
  • but a CJS WITHOUT the EXTERNAL option, or empty array.

Is this easily achievable in a vite.config.js?

    build: {
      lib: {
        entry: 'src/index.ts',
        name: 'my-library',
        fileName: 'index',
        formats: ['es','cjs'],
      },
      rollupOptions: {
        external: ['lit-html', 'lit-element', 'lit', '@lit'],
      }
    },
MrKlein
  • 95
  • 1
  • 4

0 Answers0