deno.land / x / esm@v135_2 / packages / esm-vscode
A VS Code extension automatically loads types from esm.sh CDN for JavaScript and TypeScript. No npm install
required. (Types in node_modules
will be used first, if exists)
This extension respects importmap
script tag in index.html
of your project root. With import maps, you can use "bare import specifiers", such as import React from "react"
, to work.
<!-- index.html -->
<!DOCTYPE html>
<script type="importmap">
{
"imports": {
"@jsxImportSource": "https://esm.sh/react@18.2.0",
"react": "https://esm.sh/react@18.2.0",
}
}
</script>
<script type="module" src="./app.jsx"></script>
// app.jsx
import { useState } from "react";
export default function App() {
return <h1>Hello World!</h1>;
}
The
@jsxImportSource
is a special field for jsx runtime types.
A "esm.sh: Add Module" command is also provided to add a module to the import map.
Version Info