Releases: browserify/static-module
Releases · browserify/static-module
v3.0.4
v3.0.3
Fix npm audit warning, thanks @jimmywarting!
v3.0.0
Implement scope tracking.
The core idea is this:
var fs = require('fs')
fs.readFileSync('./a.txt') // refers to require('fs'), is replaced
function whatever (fs) {
fs.readFileSync() // different fs variable, is _not_ replaced
}
Additionally, the require
call for a module will be kept if some of its uses in the file could not be replaced. For example, with fs
:
var fs = require('fs')
fs.readFileSync(__filename)
Here, require('fs')
will be removed because the fs.readFileSync
call is statically evaluated and replaced.
var fs = require('fs')
fs.readFileSync(__filename)
fs.readFile(someUserInput)
Here, the fs.readFileSync()
call is statically evaluated and replaced, but the fs.readFile
call is not because it requires a runtime value someUserInput
. In this case, the require('fs')
call is kept.