Socket
Socket
Sign inDemoInstall

esbuild-plugin-cdn-imports

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-cdn-imports

A esbuild plugin that resolves imports directly to a CDN.


Version published
Maintainers
0
Created
Source

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.

Keywords

FAQs

Package last updated on 05 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc