A Box2d Ludic extension


001.0.73 years ago4 years agoMinified + gzip package size for @ludic/ludic-box2d in KB



A Box2D Ludic extension

To load the wasm files with webpack you need to do the following:

Importing the files
import Box2D from '@ludic/ludic-box2d'
// needed for path specification
import b2Bin from '@ludic/box2d/build/Box2D_v2.3.1_min.wasm.wasm'

Box2D({locateFile: path => (path.endsWith('wasm') && b2Bin)}).then((b2)=>{
  // Module is now loaded.
  // You can now import Box2D anywhere else and
  // call things like:
  // let myVec = new Box2D.b2Vec2()
  module: {
    defaultRules: [
      { type: "javascript/auto", resolve: {} },
    rules: [
        test: /\.wasm$/,
        loader: 'file-loader',
        type: "javascript/auto"
shim-wasm.d.ts (Typescript)
// needed to prevent tsc from complaining about module not being found
declare module '*.wasm';

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.