feathers-vite
TypeScript icon, indicating that this package has built-in type declarations

1.2.7 • Public • Published

Feathers Vite Plugin

Try it Online

Requirements

  1. 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: '*' } })
  • 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
  • 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.

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i feathers-vite

    Weekly Downloads

    9

    Version

    1.2.7

    License

    ISC

    Unpacked Size

    17.6 kB

    Total Files

    17

    Last publish

    Collaborators

    • rayfoss