vite-ts-nameof
Give Vite the ability to resolve nameof calls in TypeScript.
Usage
-
Install as
devDependencies
npm install -D vite-ts-nameof # or yarn add -D vite-ts-nameof
-
Inject
vite-ts-nameof
using thevite.config.ts
moduleimport vue from "@vitejs/plugin-vue"; import { defineConfig } from "vite"; import tsNameof from "vite-ts-nameof"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [ tsNameof(), vue(), ], });
-
Add
ts-nameof.d.ts
to yourtsconfig.json
{ // "compilerOptions" // "include" // ... "files": ["./node_modules/ts-nameof/ts-nameof.d.ts"] }