Installation

    npm#

    Javelin ECS can be installed via npm:

    npm i @javelin/ecs
    

    The following builds are published to NPM:

    ES Modules#

    Path: dist/esm/index.js

    The package.json module field points to the ESM build, which will be automatically discovered by tools like Webpack, Rollup, and Node >=13.2.0.

    import * as ECS from "@javelin/ecs"
    

    You can of course also import the ES module directly in browsers that support ECMAScript modules.

    <script type="module" src="node_modules/@javelin/ecs/dist/esm/index.js"></script>
    

    CommonJS#

    Path: dist/cjs/index.js

    The package.json main field points to the CommonJS build, which will be included automatically when loaded with require:

    const ECS = require("@javelin/ecs")