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

212
Views
How to get global references from a vite lib build

I will try to start with an example that works. If I want to refer or get code intellisense from a lib a an arbitrary js file that use global I can simply use the /// (triple dash). Like in <reference path="../jquery.js"/> now I can see all types as if it is a global.

I am outputting umd and es. either way would be fine.

For example I have a umd/es build that exports two functions: 'addData' 'getData' How can I have a reference to those from an file without importing the actual lib? same as we can do with the ///<reference for JQuery.

Thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

for anyone wondering the same.

You can define your own d.ts files and put the file in your package.json. In my case I created a file index.d.ts in the src folder which I also copy to the dist when building.

and in the package.json: "types": "./path/index.d.ts"

about 4 years ago · Juan Pablo Isaza Report
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!