1.0.0 • Published 8 months ago

@packlify/config-build v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

@packlify/config-build

Part of the Packlify Web SDK ecosystem, @packlify/config-build assists you in generating optimized Vite configurations for your React-based projects, both client-side and server-side rendering (SSR) included.

Table of Contents

Installation

Install the package using npm or yarn:

npm install @packlify/config-build

Features

@packlify/config-build offers the following features:

  • Dynamic Vite configuration generation based on provided entry points.
  • TypeScript path aliasing via vite-tsconfig-paths.
  • Configures output directories and source maps automatically.

Peer Dependencies

Ensure you have the following peer dependencies installed:

npm install react react-dom react-router-dom

Usage

TypeScript (ESM)

Firstly, import the required functions:

import { viteConfigClient, viteConfigSsr } from '@packlify/config-build';

Client Configuration

To generate the Vite configuration for client-side rendering, use viteConfigClient. It takes an array of entry points:

import { viteConfigClient } from '@packlify/config-build';
import { defineConfig } from 'vite';

export default defineConfig({
  ...viteConfigClient([{ name: 'home', path: '/src/client/entries/home/home.html' }]),
});

SSR Configuration

For server-side rendering, viteConfigSsr can be employed. It also requires an array of entry points:

const ssrConfig = viteConfigSsr([
  { name: 'home', path: './src/server/entries/home/index.tsx' },
  { name: 'about', path: './src/server/entries/about/index.tsx' },
]);

API

viteConfigClient

function viteConfigClient(entryPoints: IEntryPoint[]): ReturnType<typeof defineConfig>;

Parameters

  • entryPoints: An array of entry points, each being an object with name and path properties.

viteConfigSsr

function viteConfigSsr(entryPoints: IEntryPoint[]): ReturnType<typeof defineConfig>;

Parameters

  • entryPoints: An array of entry points, each being an object with name and path properties.

Contact

Lucas Farias lukf95@gmail.com LinkedIn - GitHub

1.0.0

8 months ago

0.0.1-alpha.0

8 months ago

0.3.1

8 months ago

0.3.0

8 months ago

0.2.6-alpha.0

8 months ago

0.2.3-alpha.0

8 months ago

0.2.2-alpha.0

8 months ago

0.2.1-alpha.0

8 months ago

0.2.0-alpha.0

8 months ago

0.1.0-alpha.0

8 months ago

0.0.4-alpha.0

8 months ago

0.0.3-alpha.0

8 months ago

0.0.2-alpha.0

8 months ago