Sometimes I look back at my code or someone else's and see these crazy long require statements - sometimes, hundreds of lines long.

Some of the options for limiting the size of the require statement that I have seen are to:

  • Componentize the functions
  • Use promises or callbacks

Is it actually a big deal that the require statement gets so long?

Many aspects of a web map using the ArcGIS API for Javascript simply will not work unless scripts are run within the require statement.

Here's an example of some code I've inherited with a ridiculously long require statement. The full length is actually 300 lines long.

enter image description here



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.