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

--node with require / module #1340

Open
mattdesl opened this issue Jul 29, 2015 · 1 comment
Open

--node with require / module #1340

mattdesl opened this issue Jul 29, 2015 · 1 comment

Comments

@mattdesl
Copy link
Contributor

Are there any plans to support more native-like require and module globals when using browserify --node ?

For example:

index.js

console.log(require.resolve('url'))

Prints url with node:

node index.js

However, throws an error with browserify:

browserify index.js --node | node
TypeError: Object function (e){var n=t[o][1][e];return s(n?n:e)} has no method 'resolve'
    at Object.<anonymous> ([stdin]:2:21)
    at s ([stdin]:1:254)
    at e ([stdin]:1:425)
    at [stdin]:1:443
    at Object.<anonymous> ([stdin]-wrapper:6:22)
    at Module._compile (module.js:456:26)
    at evalScript (node.js:536:25)
    at Socket.<anonymous> (node.js:154:11)
    at Socket.emit (events.js:117:20)
    at _stream_readable.js:943:16
@ghost
Copy link

ghost commented Jul 29, 2015

Maybe require.resolve can fall back through to whatever require is already defined. This is how require() works across multiple bundles already.

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

No branches or pull requests

1 participant