As long as you deliver processed JavaScript in <script type="module">
, if the library is already an ES module.
For how to get the typings, you can use either JSDoc or *.d.ts
.
import _react from 'https://cdn.skypack.dev/react';
/** @type {import('react')} */
const react = _react
Or,
declare module 'https://cdn.skypack.dev/react' {
export * from 'react'
}
You still have to install React in package.json, though.
What about CSS? Fonts?
CSS and fonts doesn't have typings, anyway. (Unless you are talking about CSS module.) So, why don't you can consider a CDN?
Why is CDN missing for SVG icons, anyway?
Top comments (0)