deathcap / webnpm

(obsoleted by https://github.com/deathcap/nodeachrome/) browserify npm
http://deathcap.github.io/webnpm/
MIT License
3 stars 0 forks source link

Implement require.resolve #5

Open deathcap opened 9 years ago

deathcap commented 9 years ago

http://nodejs.org/api/all.html#all_require_resolve

require.resolve()#

Use the internal require() machinery to look up the location of a module, but rather than loading the module, just return the resolved filename.

had to stub out this function to load browserified browserify, but browserify doesn't implement it (npm doesn't need it, at least to load). Asking for the path of a module doesn't make much sense in a traditional browserify environment because all of the modules are concatenated into one bundle.js file, but it does in webnpm where modules may be present in the webfs.

deathcap commented 8 years ago

Needed in https://github.com/substack/insert-module-globals/blob/769f4bd08e01b77a620f2e2de1d2249c8311b0a2/index.js#L6-L7

var processPath = require.resolve('process/browser.js');
var isbufferPath = require.resolve('is-buffer')