Socket
Socket
Sign inDemoInstall

esbuild

Package Overview
Dependencies
22
Maintainers
2
Versions
446
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    esbuild

An extremely fast JavaScript and CSS bundler and minifier.


Version published
Weekly downloads
20M
decreased by-26.58%
Maintainers
2
Install size
8.71 MB
Created
Weekly downloads
 

Package description

What is esbuild?

esbuild is a fast JavaScript bundler and minifier. It compiles TypeScript and JavaScript into a single file, minifies it, and can also handle CSS and image assets. It's designed for speed and efficiency, utilizing parallelism and native Go code to achieve its performance.

What are esbuild's main functionalities?

Bundling JavaScript

This code bundles 'app.js' and its dependencies into a single file 'out.js'.

require('esbuild').build({
  entryPoints: ['app.js'],
  bundle: true,
  outfile: 'out.js'
}).catch(() => process.exit(1))

Minifying JavaScript

This code minifies 'app.js' to reduce file size and improve load times.

require('esbuild').build({
  entryPoints: ['app.js'],
  minify: true,
  outfile: 'out.js'
}).catch(() => process.exit(1))

Transpiling TypeScript

This code compiles a TypeScript file 'app.ts' into JavaScript and bundles it into 'out.js'.

require('esbuild').build({
  entryPoints: ['app.ts'],
  bundle: true,
  outfile: 'out.js'
}).catch(() => process.exit(1))

Serving files for development

This code starts a local server to serve files from the 'public' directory and bundles 'app.js' into 'public/out.js'.

require('esbuild').serve({
  servedir: 'public',
  port: 8000
}, {
  entryPoints: ['app.js'],
  bundle: true,
  outfile: 'public/out.js'
}).then(server => {
  // Server started
})

Other packages similar to esbuild

Changelog

Source

0.17.7

  • Change esbuild's parsing of TypeScript instantiation expressions to match TypeScript 4.8+ (#2907)

    This release updates esbuild's implementation of instantiation expression erasure to match microsoft/TypeScript#49353. The new rules are as follows (copied from TypeScript's PR description):

    When a potential type argument list is followed by

    • a line break,
    • an ( token,
    • a template literal string, or
    • any token except < or > that isn't the start of an expression,

    we consider that construct to be a type argument list. Otherwise we consider the construct to be a < relational expression followed by a > relational expression.

  • Ignore sideEffects: false for imported CSS files (#1370, #1458, #2905)

    This release ignores the sideEffects annotation in package.json for CSS files that are imported into JS files using esbuild's css loader. This means that these CSS files are no longer be tree-shaken.

    Importing CSS into JS causes esbuild to automatically create a CSS entry point next to the JS entry point containing the bundled CSS. Previously packages that specified some form of "sideEffects": false could potentially cause esbuild to consider one or more of the JS files on the import path to the CSS file to be side-effect free, which would result in esbuild removing that CSS file from the bundle. This was problematic because the removal of that CSS is outwardly observable, since all CSS is global, so it was incorrect for previous versions of esbuild to tree-shake CSS files imported into JS files.

  • Add constant folding for certain additional equality cases (#2394, #2895)

    This release adds constant folding for expressions similar to the following:

    // Original input
    console.log(
      null === 'foo',
      null === undefined,
      null == undefined,
      false === 0,
      false == 0,
      1 === true,
      1 == true,
    )
    
    // Old output
    console.log(
      null === "foo",
      null === void 0,
      null == void 0,
      false === 0,
      false == 0,
      1 === true,
      1 == true
    );
    
    // New output
    console.log(
      false,
      false,
      true,
      false,
      true,
      false,
      true
    );
    

Readme

Source

esbuild

This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the JavaScript API documentation for details.

FAQs

Last updated on 09 Feb 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc