Socket
Book a DemoInstallSign in
Socket

browserify-window-context

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browserify-window-context

Replaces default module context with Window

0.1.1
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

#browserify-window-context

NPM

Adds Window context to shimed module

By default in a shimed module this points to empty Object that makes a lot of non-CommonJS modules fail. This browserify transformation replaces this with Window and script runs as expected.

package.json

{
  "main": "./js/entry.js",
  "browser": {
    "old_good_script": "./js/vendor/old_good_script.js"
  },
  "browserify-shim": {
  },
  "browserify-window-context": [
    "old_good_script"
  ],
  "browserify": {
    "transform": [ "browserify-window-context", "browserify-shim" ]
  },
  "dependencies": {
    "browserify-shim": "~3.2.0",
    "browserify-window-context": "~0.1.1"
  }
}

Installation

npm install browserify-window-context

How it works

It simply wraps your script with another function and applies new window context like so:

(function () {' + data + '}).apply(window);

Setup

Add alias of your script to browser:

  "browser": {
    "old_good_script": "./js/vendor/old_good_script.js"
  },

Then add alias of your script to browserify-window-context:

  "browserify-window-context": [
    "old_good_script"
  ],

Keywords

browserify

FAQs

Package last updated on 08 Sep 2015

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.