Birch-san / box2d-wasm

Box2D physics engine compiled to WebAssembly. Supports TypeScript and ES modules.
263 stars 21 forks source link

Module not found: Error: Can't resolve 'path' in 'D:\vuecli\hello-world\node_modules\box2d-wasm\dist\es' #46

Closed a6965921 closed 2 years ago

a6965921 commented 2 years ago

image

Birch-san commented 2 years ago

Yes, that's expected in webpack 5. You can fix it by following the advice in that error message.
https://github.com/Birch-san/box2d-wasm/issues/26#issuecomment-814328442

a6965921 commented 2 years ago

how to use webpack Do not compile when referencing JS

Birch-san commented 2 years ago

I don't understand the question; what's the error message?

a6965921 commented 2 years ago

can you user vue-cli(vue2.X) write demo Put it in GitHub I need to refer to it

liangchen-harold commented 1 year ago

I've successfully ran with vue3, here is my vue.config.js

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  // workaround for box2d-wasm
  configureWebpack: config => {
    Object.assign(config.resolve.fallback = { fs: false, path: false })
  }
})