Open Bluebie opened 4 years ago
Browserify 16.5.0 does not seem to provide a .main property on the require object, so requiring app-root-path is failing because browser cannot read property .filename from require.main (which is undefined)
.main
require
.filename
require.main
undefined
https://github.com/inxilpro/node-app-root-path/blob/54d06fef2340a36070fbfc24973bb676079aa7a1/browser-shim.js#L3
You can reproduce breaking browserify with:
echo "console.log(require('app-root-path').toString())" > test.js browserify test.js -o bundle.js
and then trying to load bundle.js with a script tag in a browser.
Would you be willing to submit a PR for the browser shim?
Browserify 16.5.0 does not seem to provide a
.main
property on therequire
object, so requiring app-root-path is failing because browser cannot read property.filename
fromrequire.main
(which isundefined
)https://github.com/inxilpro/node-app-root-path/blob/54d06fef2340a36070fbfc24973bb676079aa7a1/browser-shim.js#L3
22 seems to be related to the same problem, but was closed without any more information about why.
You can reproduce breaking browserify with:
and then trying to load bundle.js with a script tag in a browser.