Thursday 4 May 2017

Node's Require, RequireJS, Browserify and Asynchronous Module Loading

I have issues with Require for a year and I want to clarify the issue besides approving the things I already learned. Other than thousands of questions when I type require.js I'll be happy if someone help to make it clearer for the community too.

  • Browsers don't have the require method defined, but Node.js does. So that Browserify can write code that uses require in the same way using Node.
  • Node.js does not use Require.js. Require.js was built that we can have asynchronous module loading in the client's browser.

Well, whenever I get an error like below,

enter image description here

After googling/stackoverflowing then I started to use Require.js hence, even it succeeds for some situation then it turned to the error below somehow,

enter image description here

And then with Browserify it definitely succeeds with some cases I tried hence, especially when with asynchronous module loading, it fails like below each single time.

enter image description here

Well it's a bit long but I'm not clear of the main practical usage and I ran into lots of fellow struggling with the issues related this. Thanks for any effort for clarification.



via Erhan Yaşar

No comments:

Post a Comment