{"id":22966,"library":"vp-runtime-helper","title":"vp-runtime-helper","description":"vp-runtime-helper v1.0.10 is a Vite plugin development utility providing helper functions for writing Vite plugins. It simplifies common tasks like path manipulation, environment detection, and plugin configuration. Released under the MIT license with TypeScript types included, it targets Vite >=3.1.0 and Node >=14.18.0. Key differentiators: designed specifically for Vite plugin authors, lightweight with zero runtime dependencies, and offers a cohesive set of utilities optimized for Vite's plugin system.","status":"active","version":"1.0.10","language":"javascript","source_language":"en","source_url":"https://github.com/fengxinming/vite-plugins","tags":["javascript","vite-plugin","vp-runtime-helper","typescript"],"install":[{"cmd":"npm install vp-runtime-helper","lang":"bash","label":"npm"},{"cmd":"yarn add vp-runtime-helper","lang":"bash","label":"yarn"},{"cmd":"pnpm add vp-runtime-helper","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package provides a default export as the main entry. CommonJS require may not work if your project is ESM-only.","wrong":"const vprh = require('vp-runtime-helper')","symbol":"default","correct":"import vprh from 'vp-runtime-helper'"},{"note":"Named exports are also available. TypeScript types are included, so you can use 'import type { HelperFunction } from 'vp-runtime-helper'.","wrong":"import HelperFunction from 'vp-runtime-helper'","symbol":"HelperFunction","correct":"import { HelperFunction } from 'vp-runtime-helper'"},{"note":"Aliasing the default import is common: `import vprh from 'vp-runtime-helper'`.","wrong":"","symbol":"default as vprh","correct":"import vprh from 'vp-runtime-helper'"}],"quickstart":{"code":"import vprh from 'vp-runtime-helper'\nimport type { Plugin } from 'vite'\n\nexport default function myPlugin(): Plugin {\n  return {\n    name: 'my-plugin',\n    config(config) {\n      console.log(vprh.resolveAlias(config.resolve?.alias))\n      if (vprh.isDev(config)) {\n        console.log('Development mode')\n      }\n      return config\n    }\n  }\n}","lang":"typescript","description":"Demonstrates how to import and use the default export and two helper functions (resolveAlias, isDev) in a Vite plugin written in TypeScript."},"warnings":[{"fix":"Ensure you are using this only inside Vite plugins or hooks.","message":"The package is designed for Vite plugin development; using it outside of a Vite context may cause unexpected behavior.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pin the vp-runtime-helper version to a specific one that works with your Vite version, and test after upgrading Vite.","message":"Some helper functions may rely on Vite's internal structures which can change between Vite versions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use the recommended alternative: vprh.newHelper or update to v1.0.10 and adapt your code accordingly.","message":"The legacy function 'vprh.legacyHelper' is deprecated in v1.0.5 and removed in v1.0.10.","severity":"deprecated","affected_versions":">=1.0.5 <1.0.10"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install the package: npm install vp-runtime-helper. If using TypeScript, ensure 'esModuleInterop' is enabled in tsconfig.json, or use a default import with 'allowSyntheticDefaultImports'.","cause":"The package may not be installed or the project is using TypeScript but missing type declarations for a CommonJS module.","error":"Cannot find module 'vp-runtime-helper' or its corresponding type declarations."},{"fix":"Use the correct default import: import vprh from 'vp-runtime-helper'. Then call vprh.isDev()","cause":"The imported object is not the default export (e.g., using named import incorrectly).","error":"TypeError: vprh.isDev is not a function"},{"fix":"Check available exports in the documentation. Use named imports correctly: import { HelperFunction } from 'vp-runtime-helper'. If bundling for browser, ensure the package is compatible and not using Node.js APIs.","cause":"Using an incorrect named export name or the import syntax is wrong in a browser context.","error":"Uncaught SyntaxError: The requested module 'vp-runtime-helper' does not provide an export named 'HelperFunction'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}