montagejs / montage

Montage is an elegant, open source HTML5 framework maintained by Montage Studio that rivals native SDKs, yet is easier to learn. It offers modular components, two-way data binding, and much more. Join us on irc.freenode.net#montage. Sign up for our beta to build Montage applications in the cloud.
http://montagestudio.com/montagejs
Other
1.5k stars 215 forks source link

MJSON objects are instantiated when the file is loaded, not required #2008

Open cdebost opened 5 years ago

cdebost commented 5 years ago

JS files are processed in two steps: first the file's text is put into memory on load, and then the contents are actually executed when the file is required. MJSON files, however, are both loaded and executed on load.

This causes issues in mop, which has to load modules but does not want to execute them, as there may be some runtime-only logic in object constructors that could crash the build. Objects should be instantiated on require instead.

A temporary work around for mop is in montagejs/mop#94