vite-plugin-yalc
raw JSON → 0.1.3 verified Mon Apr 27 auth: no javascript
A Vite plugin for library projects using yalc for local package development. Version 0.1.3 is the latest stable release, updated occasionally. It hooks into Vite's build process to automatically push the built library to the yalc store after each build. Unlike manual yalc push, it integrates seamlessly into the Vite dev workflow. Provides two main exports: `runYalc` for automatic push after build, and `runCommand` for executing arbitrary scripts before pushing. Requires yalc globally installed.
Common errors
error Cannot find module 'vite-plugin-yalc' ↓
cause Plugin not installed as dev dependency.
fix
Run
npm install vite-plugin-yalc --save-dev. error Error: yalc command not found. Please install yalc globally. ↓
cause yalc is not installed globally.
fix
Run
npm install -g yalc. Warnings
gotcha yalc must be installed globally (`npm i -g yalc`) before using this plugin, otherwise the build will fail. ↓
fix Run `npm i -g yalc` prior to using the plugin.
deprecated The `runCommand` export may be removed in a future version in favor of custom scripts. ↓
fix Use Vite's own `rollupOptions` hooks or pre-build scripts instead.
Install
npm install vite-plugin-yalc yarn add vite-plugin-yalc pnpm add vite-plugin-yalc Imports
- runYalc wrong
import runYalc from 'vite-plugin-yalc'correctimport { runYalc } from 'vite-plugin-yalc' - runCommand wrong
const runCommand = require('vite-plugin-yalc')correctimport { runCommand } from 'vite-plugin-yalc'
Quickstart
// vite.config.ts
import { defineConfig } from 'vite';
import { runYalc } from 'vite-plugin-yalc';
export default defineConfig({
build: {
lib: {
entry: 'src/index.ts',
name: 'MyLib',
formats: ['es', 'cjs'],
},
},
plugins: [runYalc()],
});