https://github.com/lucsoft/esbuild-plugin-http-imports
persistent cached http import resolution for esbuild
https://github.com/lucsoft/esbuild-plugin-http-imports
Last synced: about 1 year ago
JSON representation
persistent cached http import resolution for esbuild
- Host: GitHub
- URL: https://github.com/lucsoft/esbuild-plugin-http-imports
- Owner: lucsoft
- License: cc0-1.0
- Created: 2021-09-03T09:48:38.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-04-08T13:58:40.000Z (over 3 years ago)
- Last Synced: 2025-05-07T11:18:02.097Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://deno.land/x/esbuild_plugin_http_imports
- Size: 31.3 KB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# esbuild-plugin-http-imports
An esbuild plugin that resolves http(s) modules with persistent caching, for use with Deno.
> **NOTE**: If you want an extended esbuild development server go to https://deno.land/x/esbuild_serve
> This Plugin uses x/esbuild_serve/features/httpImports.ts for its Implementation. If you have any Bugs please report it at esbuild_serve.
## Example
```ts
// test/index.js
import { build, stop } from "https://deno.land/x/esbuild/mod.js";
import { httpImports } from "https://deno.land/x/esbuild_plugin_http_imports/index.ts";
const { outputFiles } = await build({
bundle: true,
entryPoints: ["test/hello.jsx"],
jsxFactory: "h",
plugins: [httpImports()],
write: false,
});
eval(outputFiles[0].text);
// expected:
Hello, world!
// actual: Hello, world!
stop();
```
```js
// test/hello.jsx
import { h } from "https://unpkg.com/preact@10.5.13/dist/preact.module.js";
import render from "https://unpkg.com/preact-render-to-string@5.1.19/dist/index.module.js?module";
const app =
Hello, world!
;
const html = render(app);
console.log("expected: %s", "
Hello, world!
");
console.log("actual: %s", html);
```