Socket
Socket
Sign inDemoInstall

esbuild

Package Overview
Dependencies
22
Maintainers
2
Versions
447
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-28.02%
Maintainers
2
Install size
9.04 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.20

  • Support advanced CSS @import rules (#953, #3137)

    CSS @import statements have been extended to allow additional trailing tokens after the import path. These tokens sort of make the imported file behave as if it were wrapped in a @layer, @supports, and/or @media rule. Here are some examples:

    @import url(foo.css);
    @import url(foo.css) layer;
    @import url(foo.css) layer(bar);
    @import url(foo.css) layer(bar) supports(display: flex);
    @import url(foo.css) layer(bar) supports(display: flex) print;
    @import url(foo.css) layer(bar) print;
    @import url(foo.css) supports(display: flex);
    @import url(foo.css) supports(display: flex) print;
    @import url(foo.css) print;
    

    You can read more about this advanced syntax here. With this release, esbuild will now bundle @import rules with these trailing tokens and will wrap the imported files in the corresponding rules. Note that this now means a given imported file can potentially appear in multiple places in the bundle. However, esbuild will still only load it once (e.g. on-load plugins will only run once per file, not once per import).

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 08 Aug 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