4.0.1 • Published 1 month ago

@spellix/vite-config-package v4.0.1

Weekly downloads
-
License
-
Repository
github
Last release
1 month ago

@spellix/vite-config-package

@spellix/vite-config-package is a versatile Vite configuration utility designed to streamline the build process for both React and non-React packages. It offers a customizable way to configure your Vite build, supporting TypeScript, SWC, and Rollup plugins.

Options

  • generateDts (boolean): Generate TypeScript declaration files.
  • addClientDirective (boolean): Add client directive using Rollup plugin.
  • externalPackages (string[]): List of external packages for the build.
  • formats (LibraryFormats[]): Output formats for the library build.
  • externalInputs (InputOption): External input sources.
  • isReact (boolean): Flag to include React specific plugins.

Peer Dependencies

Ensure the following peer dependencies are installed in your project:

  • @vitejs/plugin-react-swc
  • typescript
  • vite
  • vite-plugin-dts

Installation

npm install @spellix/vite-config-package @vitejs/plugin-react-swc typescript vite vite-plugin-dts --save-dev
# or
yarn add @spellix/vite-config-package @vitejs/plugin-react-swc typescript vite vite-plugin-dts --dev
# or
pnpm install @spellix/vite-config-package @vitejs/plugin-react-swc typescript vite vite-plugin-dts --D

Usage

Import getViteConfig from the package and configure it as needed:

import { getViteConfig } from '@spellix/vite-config-package';

const config = getViteConfig({
  // Your custom configuration options here
});

export default config;