Socket
Book a DemoInstallSign in
Socket

is-browser-transform

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-browser-transform

Static browserify transform for "is-browser" npm module

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

is-browser-transform

Static browserify transform for "is-browser" npm module. Perfect to run just before the uglifyify transform and in conjunction with the envify transform.

Build Status Dependency Status NPM version

Installation

npm install is-browser-transform

Basic Usage

To replace all instances of require('is-browser') with the literal true.

browserify -g is-browser-transform ./index.js > bundle.js

or

var browserify = require('browserify')
var fs = require('fs')

var bundler = browserify(__dirname + '/index.js')

bundler.transform({
  global: true
}, require('is-browser-transform'))

bundler.bundle()
  .pipe(fs.createWriteStream(__dirname + '/bundle.js'))

Advanced Usage

To replace all instances of require('is-browser') with the literal true and replace all instances of require('the-answer-to-everything') with the literal 42:

var browserify = require('browserify')
var fs = require('fs')

var bundler = browserify(__dirname + '/index.js')

bundler.transform({
  global: true,
  modules: { 'the-answer-to-everything': 42 }
}, require('is-browser-transform'))

bundler.bundle()
  .pipe(fs.createWriteStream(__dirname + '/bundle.js'))

This module understands strings, numbers and booleans as constant values of modules.

License

MIT

FAQs

Package last updated on 05 Oct 2017

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