You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library provides a simple way to parse a manifest.json file generated by Vite and render corresponding HTML code blocks for easy backend integration. It is particularly useful for projects where the frontend is managed by Vite and the backend requires integration of the generated assets.
Features
Parses manifest.json to generate HTML script and link tags.
Supports both development and production environments.
Handles legacy browser scripts and polyfill loading.
Installation
To install vite-manifest-parser, run the following command:
npm install vite-manifest-parser --save
Usage
To use the parser, you need to import the parser function from the package and call it with the appropriate parameters.
import{parser}from'vite-manifest-parser';constinput='src/app/main.ts';// Your entry fileconstoutDir='/absolute/path/to/dist';// Your build directoryconstpublicPath='/public/dist/';// Public path to your assetsconstisDev=process.env.NODE_ENV!=='production';// Determine the environmentconst{ preload, css, js }=awaitparser({ input, outDir, publicPath, isDev });
For template usage, such as rendering with EJS templates.