capaj / require-globify

transform for browserify, which allows to require files with globbing expressions
MIT License
70 stars 11 forks source link

Runninh in node vs browser #32

Open ainthek opened 7 years ago

ainthek commented 7 years ago

I may have missed something, I want my original code to ALWAYS run in node and sometimes in browser. But when i use require(glob) syntax it brakes node API and code will not run in node of course. How is this module to be used in pure node environment ? We need both.

call-a3 commented 7 years ago

This module is not intended to enhance or replace node's built-in require functionality. Therefore, you'll never be able to execute source code directly if it contains our alternative syntax. What you could do however, is use browserify similar to how you'd use it to build for the browser, but use the --node option to build your bundle for the server instead. That should give you a bundle that's executable in node