feathers-vite
v1.2.7
Published
A vite plugin to run Feathers and other Node servers.
Downloads
107
Maintainers
Readme
Feathers Vite Plugin
Try it Online
Requirements
- Your Feathers app needs to be created, setup and returned in a function called main
Example usage:
// vite.config.ts
// https://vitejs.dev/config/
import { defineConfig } from 'vite'
import { feathers } from 'feathers-vite'
// https://vitejs.dev/config/#async-config
export default defineConfig(async () => {
return {
plugins: [feathers({ app: 'src/app.ts', port: 8099 })]
}
})
Important notes
- Your feathers server will run on another port... make sure to configure socket.io with cors
- ie:
socketio({ cors: { origin: '*' } })
- ie:
- To make things easier, an Environment Variable named VITE_FV_URL is defined in development.
- In client apps
const url = import.meta.env.VITE_FV_URL
- In client apps
- We listen to the an env var named VITE_FV_SSG, if it is set to "off" the plugin won't run.
- This plugin will not run with the build command.