This is probably a lame question, but how can you achieve the same thing as require()
(Node.js) in regular JavaScript?
Some help would really be appreciated.
There are several services that let you do this.
The most popular is Browserify.
Basically, it entails going through the file reading through the syntax tree and converting it to the a style similar to what RequireJS does.
Note that this requires an extra compilation step. (We will eventually get modules in ES6 though so there's that :) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With