1.0.1 • Published 1 year ago

esbuild-external-global v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

esbuild-external-global

npm package Build Status Downloads Issues Code Coverage Commitizen Friendly

This is a plugin for esbuild that allows you to define global variables that are not bundled by esbuild.

Installation

npm install esbuild-external-global

Usage

const esbuild = require("esbuild");
const { externalGlobal } = require("esbuild-external-global");

const externalReact = externalGlobal({
  react: "window.React",
});

esbuild
  .build(
    externalReact({
      entryPoints: [path.resolve(__dirname, "fixtures/react/index.tsx")],
      bundle: true,
      write: false,
    }),
  )
  .then(() => {
    console.log("Build succeeded");
  })
  .catch(() => {
    console.error("Build failed");
  });

Why not use plugins?

There is no difference in essence esbuild#337, except that plugins in esbuild cannot be called by pipes esbuild#1902. In order not to affect other existing plugins, we use aliases instead.

1.0.1

1 year ago

1.0.0

1 year ago