npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

haxe-modular

v0.14.0

Published

[![TravisCI Build Status](https://travis-ci.org/elsassph/haxe-modular.svg?branch=master)](https://travis-ci.org/elsassph/haxe-modular) [![Haxelib Version](https://img.shields.io/github/tag/elsassph/haxe-modular.svg?label=haxelib)](http://lib.haxe.org/p/mo

Downloads

380

Readme

Haxe Modular

TravisCI Build Status Haxelib Version npm Version Downloads Join the chat at https://gitter.im/haxe-react/haxe-modular

Code splitting and hot-reload for Haxe JavaScript applications.

Why?

If you use Haxe for JavaScript, directly or indirectly (React, OpenFl,...), then you probably want to:

  • make your web app load instantly,
  • make your HTML5 game load quicker,
  • load sections / features / mini-games on-demand.

Haxe has an excellent, compact and optimised JS output, but it's always a single file; even with good minification / gzip compression it can be a large payload.

Modular can split gigantic Haxe-JS outputs into load-on-demand features, without size/speed overhead, and without losing sourcemaps.

How?

import MyClass;
...
load(MyClass).then(function(_) {
	var c = new MyClass();
});

The approach is to reference one class asynchronously in your code:

  • at compile time, the dependency graph of the class is built and one additional JS file will be emitted (bundling this class and all its dependencies),
  • at run time, when the aynchronous reference is evaluated, the additional JS is loaded (once) automatically.

Where to start?

There are 2 ways to use Haxe Modular, depending on your project/toolchain/goals:

  1. standalone Modular; zero dependencies, for any Haxe-JS project,
  2. Webpack Haxe Loader; leverage the famous JS toolchain.

In both cases, it is advisable to read about the technical details:

What is the difference?

Both solutions:

  • use Modular splitting under the hood,
  • split automatically using a single hxml build configuration,
  • support NPM dependencies,
  • allow hot-reloading of code.

What should I use?

  1. Standalone Modular is an easy, drop-in, addition to a regular Haxe JS build process - it is very lightweight and unobstrusive, and you don't need to learn Webpack.

    Using NPM modules however requires a bit of ceremony: all the NPM dependencies have to be gathered (manually) in a libs.js which is loaded upfront.

  2. Webpack Haxe Loader is a more powerful setup but you'll have to learn Webpack. Webpack is a complex and large system offering vast possibilities from the JS ecosystem.

FAQ

Q: Where can I get more help? I have questions / issues...

Q: Is it only for React projects?

  • Of course not; anything targeting JavaScript can use it.
  • However it does offer React-specific additional features for code hot-reloading.

Q: Is it possible to minify the code?

Q: Can I extract a library/package from my code?

  • Yes: you can split libraries, but for technical reasons, extracting a library (e.g. many classes used across the application) has some limitations.

Q: Can I still use the includeFile macro to inject JS code in the output?

  • Yes, but only when the code is inserted at the top of the file; this is the default position when using --macro includeFile('my-lib.js').

Q: Does it support Haxe 4's ES6 output? (-D js-es=6)

  • Yes since 0.12.0