{"id":20406566,"url":"https://github.com/elsassph/haxe-modular","last_synced_at":"2025-04-13T08:26:48.935Z","repository":{"id":13357676,"uuid":"74237041","full_name":"elsassph/haxe-modular","owner":"elsassph","description":"Haxe-JS code splitting, NPM dependencies bundling, hot-reload","archived":false,"fork":false,"pushed_at":"2022-04-26T09:15:48.000Z","size":528,"stargazers_count":116,"open_issues_count":14,"forks_count":14,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-24T10:55:37.116Z","etag":null,"topics":["code-splitting","haxe","javascript"],"latest_commit_sha":null,"homepage":"","language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elsassph.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-19T21:39:27.000Z","updated_at":"2023-09-04T10:42:59.000Z","dependencies_parsed_at":"2022-08-07T07:15:14.593Z","dependency_job_id":null,"html_url":"https://github.com/elsassph/haxe-modular","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsassph%2Fhaxe-modular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsassph%2Fhaxe-modular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsassph%2Fhaxe-modular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsassph%2Fhaxe-modular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elsassph","download_url":"https://codeload.github.com/elsassph/haxe-modular/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248683012,"owners_count":21144863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-splitting","haxe","javascript"],"created_at":"2024-11-15T05:18:02.119Z","updated_at":"2025-04-13T08:26:48.910Z","avatar_url":"https://github.com/elsassph.png","language":"Haxe","readme":"# Haxe Modular\n\n[![TravisCI Build Status](https://travis-ci.org/elsassph/haxe-modular.svg?branch=master)](https://travis-ci.org/elsassph/haxe-modular)\n[![Haxelib Version](https://img.shields.io/github/tag/elsassph/haxe-modular.svg?label=haxelib)](http://lib.haxe.org/p/modular)\n[![npm Version](https://img.shields.io/npm/v/haxe-modular.svg)](https://www.npmjs.com/package/haxe-modular)\n[![Downloads](http://img.shields.io/npm/dm/haxe-modular.svg)](https://npmjs.org/package/haxe-modular)\n[![Join the chat at https://gitter.im/haxe-react/haxe-modular](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg)](https://gitter.im/haxe-react/haxe-modular)\n\nCode splitting and hot-reload for Haxe JavaScript applications.\n\n## Why?\n\nIf you use **Haxe for JavaScript**, directly or indirectly (React, OpenFl,...), then\nyou probably want to:\n\n- make your web app load instantly,\n- make your HTML5 game load quicker,\n- load sections / features / mini-games on-demand.\n\nHaxe has an excellent, compact and optimised JS output, but it's always a single file;\neven with good minification / gzip compression it can be a large payload.\n\n*Modular can split gigantic Haxe-JS outputs into load-on-demand features,\nwithout size/speed overhead, and without losing sourcemaps.*\n\n## How?\n\n```haxe\nimport MyClass;\n...\nload(MyClass).then(function(_) {\n\tvar c = new MyClass();\n});\n```\n\nThe approach is to *reference one class asynchronously* in your code:\n\n- **at compile time**, the *dependency graph* of the class is built and one additional JS\nfile will be emitted (bundling this class and all its dependencies),\n- **at run time**, when the aynchronous reference is evaluated, the additional JS is\nloaded (once) automatically.\n\n## Where to start?\n\nThere are 2 ways to use Haxe Modular, depending on your project/toolchain/goals:\n\n1. [standalone Modular](doc/start.md); zero dependencies, for any Haxe-JS project,\n2. [Webpack Haxe Loader](https://github.com/jasononeil/webpack-haxe-loader);\n   leverage the famous JS toolchain.\n\nIn both cases, it is advisable to read about the technical details:\n\n- [How to extract/split whole libraries?](doc/libraries.md)\n- [Using Reflection? Need more granular control of bundling?](doc/advanced.md)\n- [How does on-demand loading work at run time?](doc/how.md)\n\n### What is the difference?\n\nBoth solutions:\n\n- use Modular splitting under the hood,\n- split automatically using a single `hxml` build configuration,\n- support NPM dependencies,\n- allow hot-reloading of code.\n\n### What should I use?\n\n1. [Standalone Modular](doc/start.md) is an easy, drop-in, addition to a regular\n   Haxe JS build process - it is very lightweight and unobstrusive, and you don't need\n   to learn Webpack.\n\n   Using NPM modules however requires a bit of ceremony: all the NPM dependencies have to\n   be gathered (manually) in a `libs.js` which is loaded upfront.\n\n2. [Webpack Haxe Loader](https://github.com/jasononeil/webpack-haxe-loader) is a more\n   powerful setup but you'll have to learn Webpack. Webpack is a complex and large system\n   offering vast possibilities from the JS ecosystem.\n\n### FAQ\n\nQ: Where can I get more help? I have questions / issues...\n\n- Join [haxe-modular chat on Gitter.im](https://gitter.im/haxe-react/haxe-modular)\n\nQ: Is it only for React projects?\n\n- **Of course not**; anything targeting JavaScript can use it.\n- However it does offer React-specific additional features for code hot-reloading.\n\nQ: Is it possible to minify the code?\n\n- **Yes**, with [Standalone Modular](doc/start.md) you can either minify each script\n  yourself, or use `uglifyjs` or `closure` haxelibs for that:\n  [releasing to production](doc/production-release.md).\n- **Yes**, with [Webpack Haxe Loader](https://github.com/jasononeil/webpack-haxe-loader)\n  it will be taken care of by Webpack as part of the production build minification.\n\nQ: Can I extract a library/package from my code?\n\n- **Yes**: [you can split libraries](doc/libraries.md), but for technical reasons,\n  extracting a library (e.g. many classes used across the application) has some limitations.\n\nQ: Can I still use the `includeFile` macro to inject JS code in the output?\n\n- **Yes, but** only when the code is inserted at the top of the file; this is the\n  default position when using `--macro includeFile('my-lib.js')`.\n\nQ: Does it support Haxe 4's ES6 output? (`-D js-es=6`)\n\n- **Yes** since 0.12.0\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felsassph%2Fhaxe-modular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felsassph%2Fhaxe-modular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felsassph%2Fhaxe-modular/lists"}