zhaojinyu e984acc6d0 first commit hai 10 meses
..
lib e984acc6d0 first commit hai 10 meses
LICENSE e984acc6d0 first commit hai 10 meses
README.md e984acc6d0 first commit hai 10 meses
package.json e984acc6d0 first commit hai 10 meses
types.d.ts e984acc6d0 first commit hai 10 meses

README.md

@univerjs/vite-plugin

Installation

npm install @univerjs/vite-plugin

Usage

Add the plugin to your vite.config.ts:

import { univerPlugin } from '@univerjs/vite-plugin'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [
    univerPlugin()
  ]
})

Features

Automatic Import of Required CSS

This feature is enabled by default. You can disable it by passing css: false to the plugin options.

export default defineConfig({
  plugins: [
    univerPlugin({
+      css: false
    })
  ]
})

Simplified Import of Language Packs

The plugin provides a virtual module univer:locales, which simplifies the import of language packs.

import { LocaleType } from '@univerjs/core'

import { enUS, faIR, ruRU, viVN, zhCN, zhTW } from 'univer:locales'

new Univer({
  locales: {
    [LocaleType.ZH_CN]: zhCN,
    [LocaleType.EN_US]: enUS,
    [LocaleType.RU_RU]: ruRU,
    [LocaleType.VI_VN]: viVN,
    [LocaleType.ZH_TW]: zhTW,
    [LocaleType.FA_IR]: faIR,
  }
})

TypeScript Support

In order for TypeScript to recognize the univer:locales import, you should add a reference to the src/vite-env.d.ts file in your project.

/// <reference types="vite/client" />
+ /// <reference types="@univerjs/vite-plugin/types" />

Options

  • css: boolean - Whether to automatically import required CSS. Default is true.