Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
¿Cómo agrego tipos a una compilación de biblioteca Vite?

Seguí la documentación de vite para usar el modo de biblioteca y puedo producir una biblioteca de componentes de trabajo.
Creé el proyecto con el ajuste preestablecido vue-ts y en mi componente definí accesorios con sus tipos y usé algunas interfaces. Pero cuando construyo la biblioteca, no hay tipos incluidos.

¿Cómo agrego tipos para la compilación final, ya sea inferidos de los componentes de forma automática o manual con archivos de definición?

Más información Aquí hay más información sobre mis archivos:
tsconfig.json

 { "name": "@mneelansh/test-lib", "private": false, "version": "0.0.2", "scripts": { "dev": "vite", "build": "vue-tsc --noEmit && vite build", "preview": "vite preview" }, "emitDeclarationOnly": true, // testing "declaration": true, // testing "main": "./dist/lib.umd.js", "module": "./dist/lib.es.js", "types": "./dist/main.d.ts", "exports": { ".": { "import": "./dist/lib.es.js", "require": "./dist/lib.umd.js" }, "./dist/style.css": "./dist/style.css" }, "files": [ "dist" ], "dependencies": { "@types/node": "^17.0.25", "vue": "^3.2.25" }, "devDependencies": { "@vitejs/plugin-vue": "^2.3.1", "typescript": "^4.5.4", "vite": "^2.9.5", "vue-tsc": "^0.34.7" } }

emitDeclarationOnly y las propiedades de declaration , pero eso no ayudó.

Mi vite.config.ts :

 import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; const path = require("path"); // https://vitejs.dev/config/ export default defineConfig({ build: { lib: { entry: path.resolve(__dirname, "src/index.ts"), name: "Button", fileName: (format) => `lib.${format}.js`, }, rollupOptions: { external: ["vue"], output: { globals: { vue: "Vue", }, }, }, }, plugins: [vue()], });
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!