1.0.7 • Published 6 years ago

@ludic/ludic-box2d v1.0.7

Weekly downloads
-
License
-
Repository
github
Last release
6 years ago

ludic-box2d

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()
})
webpack.config.js
{
  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';
1.0.7

6 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago