Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
67
rated 0 times [  72] [ 5]  / answers: 1 / hits: 26468  / 11 Years ago, mon, february 17, 2014, 12:00:00

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.


More From » node.js

 Answers
10

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 :) )


[#72494] Friday, February 14, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lidialyrick

Total Points: 737
Total Questions: 104
Total Answers: 89

Location: Andorra
Member since Sat, May 27, 2023
1 Year ago
lidialyrick questions
;