[Documentation](https://project-graph.top/docs/unplugin-original-class-name
Add original names of classes to the dist code.
Sometimes, we need to get the name of the classes we get from import.meta.glob, but after the code is compiled and minified, the names of the classes will be minified to less characters.
The plugin adds a static property to all classes with the original name, so that we can get the original name of the class in the compiled code.
npm i -D @graphifif/unplugin-original-class-name
# or use pnpm
pnpm i -D @graphifif/unplugin-original-class-nameAdd the plugin to vite.config.ts:
import { defineConfig } from "vite";
import originalClassName from "@graphifif/unplugin-original-class-name
export default defineConfig({
plugins: [
originalClassName({
staticMethodName: "className", // or any other name you like
}),
],
});Add declaration to src/vite-env.d.ts:
/// <reference types="@graphifif/unplugin-original-class-nameient" />Add declaration to tsconfig.json:
{
"compilerOptions": {
// ...
"types": ["@graphifif/unplugin-original-class-nameient"]
}
// ...
}