Skip to content

To Build or Not to Build

Frédéric Jouault edited this page Dec 15, 2022 · 1 revision

AnimUML can currently be used either built (all .js files merged into a single one by webpack, and possibly rewritten and minified by Babel) or not, both on the Web and in Node.js. Almost all modules can be loaded as is in the browser.

Advantages of Not Building

  • no need to build after a modification, just reloading the page works
  • slightly simpler debugging (no need to deal with source maps)

Drawbacks of Not Building

  • less efficient to load
    • but we can still use a built minified version for public deployments
  • for workers (e.g., module AnalysisWorker), some browsers (e.g., Firefox) do not allow ECMAScript modules yet (see the MDN module documentation)
    • worker code must therefore be built (at least transformed into non-ECMAScript modules) for these browsers
    • but it is still possible to use the non-minified versions in Chrome, for instance, while debugging
  • building has many advantages, which we do not get without building
    • language translation, for instance:
      • for parsers:
        • AnimUML uses PEG.js grammars to parse PlantUML-like syntaxes, and JavaScript code used in transition guards, and effects, as well as in operation bodies
        • The parsers are currently generated dynamically at run time
          • They could be generated ahead-of-time
      • for TypeScript support, which is not currently used in AnimUML
    • faster transfer from server to browser
      • packing everything in a single js file
      • minification
    • wider compatibility
      • newer JavaScript features can be translated down to features supported by older JavaScript versions

Clone this wiki locally