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
25M
decreased by-9.19%
Maintainers
2
Install size
8.91 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.18.12

  • Fix a panic with const enum inside parentheses (#3205)

    This release fixes an edge case where esbuild could potentially panic if a TypeScript const enum statement was used inside of a parenthesized expression and was followed by certain other scope-related statements. Here's a minimal example that triggers this edge case:

    (() => {
      const enum E { a };
      () => E.a
    })
    
  • Allow a newline in the middle of TypeScript export type statement (#3225)

    Previously esbuild incorrectly rejected the following valid TypeScript code:

    export type
    { T };
    
    export type
    * as foo from 'bar';
    

    Code that uses a newline after export type is now allowed starting with this release.

  • Fix cross-module inlining of string enums (#3210)

    A refactoring typo in version 0.18.9 accidentally introduced a regression with cross-module inlining of string enums when combined with computed property accesses. This regression has been fixed.

  • Rewrite .js to .ts inside packages with exports (#3201)

    Packages with the exports field are supposed to disable node's path resolution behavior that allows you to import a file with a different extension than the one in the source code (for example, importing foo/bar to get foo/bar.js). And TypeScript has behavior where you can import a non-existent .js file and you will get the .ts file instead. Previously the presence of the exports field caused esbuild to disable all extension manipulation stuff which included both node's implicit file extension searching and TypeScript's file extension swapping. However, TypeScript appears to always apply file extension swapping even in this case. So with this release, esbuild will now rewrite .js to .ts even inside packages with exports.

  • Fix a redirect edge case in esbuild's development server (#3208)

    The development server canonicalizes directory URLs by adding a trailing slash. For example, visiting /about redirects to /about/ if /about/index.html would be served. However, if the requested path begins with two slashes, then the redirect incorrectly turned into a protocol-relative URL. For example, visiting //about redirected to //about/ which the browser turns into http://about/. This release fixes the bug by canonicalizing the URL path when doing this redirect.

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 13 Jul 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