Skip to content

Incompatible with Browserify #42

Description

@Bluebie

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions