New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-plugin-browserify-adapter

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-browserify-adapter

Use Browserify transforms as esbuild plugins

0.1.4
latest
Source
npm
Version published
Maintainers
1
Created
Source

esbuild-plugin-browserify-adapter

Use Browserify transforms as esbuild plugins.

Installation

The package is released to npm as esbuild-plugin-browserify-adapter:

npm install esbuild-plugin-browserify-adapter -D

Usage

This adapter lets you use any existing Browserify transform as an esbuild plugin. The plugin function can be passed an arbitrary number of transforms. Just like with Browserify itself, options are passed by wrapping the transform in an array and appending the options to that list.

Please note: This module does not work with Browserify plugins.

Basic usage

const esbuild = require('esbuild')
const coffeeify = require('coffeeify') // any transform works
const browserifyAdapter = require('esbuild-plugin-browserify-adapter')

esbuild.build({
  entryPoints: ['./app.coffee'],
  bundle: true,
  plugins: [browserifyAdapter(coffeeify)],
  outdir: './public'
})

Passing options

const esbuild = require('esbuild')
const envify = require('envify') // any transform works
const browserifyAdapter = require('esbuild-plugin-browserify-adapter')

esbuild.build({
  entryPoints: ['./app.js'],
  bundle: true,
  plugins: [browserifyAdapter([envify, { BUNDLE_TIME: new Date().toJSON() }])],
  outdir: './public'
})

Passing multiple transforms

In case you need to use multiple transforms, pass all of them to the adapter at once. Just like in Browserify, they will be run in the order given.

const esbuild = require('esbuild')
const coffeeify = require('coffeeify') // any transform works
const envify = require('envify') // any transform works
const browserifyAdapter = require('esbuild-plugin-browserify-adapter')

esbuild.build({
  entryPoints: ['./app.coffee'],
  bundle: true,
  plugins: [browserifyAdapter(
    coffeeify,
    [envify, { BUNDLE_TIME: new Date().toJSON() }]
  )],
  outdir: './public'
})

Why?

This plugin can help you with gradually migrating a Browserify-based setup to an esbuild-based one without having to change everything at once. It is not intended to be used as a permanent solution unless your transform usage is very limited.

Releasing a new version

New versions can be released using npm version <patch|minor|major>.

License

Copyright 2021 Frederik Ring - Available under the Mozilla Public License 2.0

Keywords

browserify

FAQs

Package last updated on 07 Feb 2021

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