#browserify-window-context
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.
{
"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"
}
}
npm install browserify-window-context
It simply wraps your script with another function and applies new window
context like so:
(function () {' + data + '}).apply(window);
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"
],