Registry / web-framework / oc-vite

oc-vite

JSON →
library7.1.12jsnpmunverified

oc-vite is a modified fork of Vite that enables external asset support in library mode. Current stable version is 7.1.12. It follows Vite's release cadence and provides all Vite 7 features plus custom asset handling for library builds. The key differentiator is allowing users to configure external assets (e.g., images, fonts) as separate files instead of inlining them, which is useful for library authors publishing to npm. It ships TypeScript declarations and requires Node ^20.19.0 or >=22.12.0. Compared to standard Vite, oc-vite adds a specific hook or configuration option for library assets; otherwise identical to Vite in API and behavior.

npm install oc-vite
INSTALL
IMPORT
SIG · OC-VITE
O
oc-vite
web-frameworkjavascriptv7.1.12
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

defineConfig
import { defineConfig } from 'vite'
const { defineConfig } = require('vite')
Vite is ESM-only since v4; CommonJS require is not supported. Always use ES module imports.
default (createServer)
import { createServer } from 'vite'
import vite from 'vite'; vite.createServer()
Do not use default import; named exports are preferred and consistently typed.
type UserConfig
import type { UserConfig } from 'vite'
import { UserConfig } from 'vite'
Use import type for TypeScript types to avoid runtime bundling. Valid for all Vite 5+.

Demonstrates a basic Vite library configuration with external dependencies and multiple output formats.

import { defineConfig } from 'vite' import { resolve } from 'path' export default defineConfig({ build: { lib: { entry: resolve(__dirname, 'src/index.ts'), name: 'MyLib', formats: ['es', 'cjs', 'umd'], }, rollupOptions: { external: ['react'], output: { globals: { react: 'React', }, }, }, }, })
oc-vite --version
Debug
Known issues
breakingVite 5 dropped CommonJS support entirely; require() will fail.
fix
Switch to ESM imports (import { ... } from 'vite') or use dynamic import().
affects: >=5.0.0
breakingSince Vite 4, the default Node.js resolver no longer handles .json or .wasm imports without explicit extensions.
fix
Append file extensions e.g., import data from './data.json' with { assert: { type: 'json' } }.
affects: >=4.0.0
gotchaUsing the `define` config option with strings that contain template literals can break due to unsafe minification.
fix
Wrap values in JSON.stringify() to avoid syntax errors, e.g., __APP_VERSION__: JSON.stringify('1.0.0').
affects: >=2.0.0
deprecatedThe `optimizeDeps.force` option is deprecated and no longer functional since Vite 6.
fix
Use `optimizeDeps.include` and `optimizeDeps.exclude` explicitly instead.
affects: >=6.0.0
Errors
Common errors & fixes
Error: @vitejs/plugin-vue requires vue (>=3.2.13) or @vue/compiler-sfc to be present in the dependency tree.
Missing required peer dependency when using Vue plugin.
fix
npm install vue@^3.2.13 or yarn add vue@^3.2.13.
Error: You installed esbuild on another platform than the one you're currently on. This won't work.
Incorrect esbuild binary for the current OS due to npm cache or wrong node version.
fix
Delete node_modules and package-lock.json, then run 'npm install' again. Alternatively, reinstall esbuild: 'npm rebuild esbuild'.
Error: Cannot find module 'vite'
Vite not installed or not in node_modules.
fix
Run 'npm install vite' or 'yarn add vite'.
Error: Could not resolve 'react/jsx-runtime' (added by Vite's pre-bundling)
Vite's pre-bundling fails to resolve certain React packages when using React 17/18 without the automatic JSX runtime.
fix
Ensure 'react/jsx-runtime' is installed (available in React 17+). Add to 'optimizeDeps.include' if needed.
Upgrade
Version history
7.1.12latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
oc-vite — npm install oc-vite · libregistry