Skip to content

Bundling a library entrypoint #264

Answered by ElMassimo
woodhull asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Nathan!

If I understood correctly, your JS library would be built and released separately from the Rails deployment.

If that's the case, it makes sense to use a different config to build that. You should be able to share most of the config by importing one file, for example:

// vite.library-config.ts

import { defineConfig } from 'vite'
import vite from './vite.config'

export default defineConfig({
  ...vite,
  build: {
    lib: {
      ...
    },
  },
})

I haven't had a similar use case, so not sure if library mode will "win" at setting rollupOptions.input—which is configured by vite-plugin-ruby based on your entrypoints—or if the plugin would override your config.

If the latter happ…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ElMassimo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants