Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with Browserify #42

Open
Bluebie opened this issue Feb 2, 2020 · 1 comment
Open

Incompatible with Browserify #42

Bluebie opened this issue Feb 2, 2020 · 1 comment

Comments

@Bluebie
Copy link

Bluebie commented Feb 2, 2020

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)

exports.path = require('path').dirname(require.main.filename);

#22 seems to be related to the same problem, but was closed without any more information about why.

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.

@inxilpro
Copy link
Owner

Would you be willing to submit a PR for the browser shim?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants