npm.io
0.11.2 • Published 1 week ago

@jitar/plugin-vite

Licence
MIT
Version
0.11.2
Deps
0
Size
8 kB
Vulns
0
Weekly
0
Stars
166

Jitar Plugin for Vite

This plugin allows you to use Vite to build your Jitar app.

Installation

npm install --save-dev @jitar/plugin-vite

Usage

The plugin needs to be added to the vite config file.

// vite.config.ts
import { defineConfig } from 'vite'
import jitar, { JitarConfig } from '@jitar/plugin-vite'

const jitarConfig: JitarConfig = {
  sourceDir: 'src',
  targetDir: 'dist',
  jitarDir: 'domain',
  jitarUrl: 'http://localhost:3000',
  segments: [],
  middleware: []
}

export default defineConfig({
  plugins: [
    jitar(jitarConfig)
  ]
})

The plugin accepts a configuration object with the following properties:

  • sourceDir - The folder containing the app’s source files. In most cases, this is the src folder.
  • targetDir - The folder where the app’s distribution files are output. In most cases, this is the dist folder.
  • jitarDir - The folder containing the source files used by Jitar, relative to the source root. We typically use domain (which refers to src/domain), but feel free to use a different path.
  • jitarUrl - The URL of the Jitar instance. By default, Jitar uses http://localhost:3000, but this can be changed in the Jitar configuration.
  • segments - The segments to use for the client app. This should be an array of strings. The default value is an empty array.
  • middleware - The middleware to use for the client app. This should be an array of strings. The default value is an empty array.