1.0.0 ā€¢ Published 3 months ago

esbuild-plugin-cdn-imports v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

esbuild-plugin-cdn-imports

npm version npm downloads

āœØ Intercepts imports and resolves them to a CDN URL - useful for places where the filesystem is not available, such as in the browser.

šŸ“¦ Installation

npm install -D esbuild esbuild-plugin-cdn-imports

šŸ“š Usage

Add this to your build file

import { build } from "esbuild";
import { CDNImports } from "esbuild-plugin-cdn-imports";

const yourConfig = {};

await build({
  ...yourConfig,
  plugins: [
    CDNImports({
      // Available cdns: "esm", "unpkg", "jsdelivr", "skypack"
      cdn: "esm",
      versions: {
        // The version of the package to use
        // If not specified, the latest version will be used
        "react": "17.0.2",
        "react-dom": "17.0.2"
      },
      // This will not be resolved to a CDN URL
      exclude: ["@prisma/client"]
    })
  ]
});

šŸ“„ License

Published under MIT License.

1.0.0

3 months ago

0.1.2

11 months ago

0.1.1

1 year ago

0.1.0

1 year ago