JorgenVatle / meteor-vite

⚡ Replace Meteor's bundler with Vite for blazing fast build-times
MIT License
16 stars 5 forks source link

Use Vite plugin for configuration #62

Closed JorgenVatle closed 6 months ago

JorgenVatle commented 6 months ago

Refactor Meteor-Vite configuration to be done through a Vite plugin instead of an untyped top-level property in the Vite user config.

The new configuration approach is fully optional and backwards compatible with the old config format.

Configuring Vite using meteor-vite/plugin allows you to run Vite independently of Meteor. Which can come in handy if you want to test a Vite build without having to spin up the Meteor as well.

Old config

// vite.config.js
import { defineConfig } from 'vite'
import { meteor } from 'meteor-vite/plugin';

export default defineConfig({
  // ...

   meteor: {
     clientEntry: 'imports/entrypoint/vite.ts',
   }
})

New config

// vite.config.js
import { defineConfig } from 'vite'
import { meteor } from 'meteor-vite/plugin';

export default defineConfig({
    plugins: [
        meteor({
          clientEntry: 'imports/entrypoint/vite.ts',
        }),
    ],
})