import * as Recast from 'recast-detour'
import { RecastJSPlugin } from '@babylonjs/core'
let recast = await Recast();
const navigationPlugin = new RecastJSPlugin(recast);
Then send an error: Uncaught (in promise) TypeError: Cannot set properties of undefined (setting ‘Recast’)
I met the same problem, when importing ‘recast-detour’ package,
import * as BABYLON from '@babylonjs/core'
import Recast from 'recast-detour
const recast = await Recast
const navigationPlugin = new BABYLON.RecastJSPlugin(recast)
the error is blow:
SyntaxError: The requested module '....XXX' does not provide an export named 'fileURLToPath'
It seems about the ES6 module input error. Accourding to this post, I change the first line of d.ts file. But not work it out.
Can someone show demo using recast-detour via NPM?
Thank you for the quick update @RaananW, creating an ESM-Friendly version of the package should fix the issue in my case i believe (i am using Vite instead of Webpack, which doesn’t transpile modules in development mode)
Hi Yannis, by any chance, were you able to make it work with your setup (mine looks quite similar, using Vite through Quasar framework).
I have been stuck for days. I gave up seeking a clean solution waiting for the ESM friendly version of recast-detour, and I was convinced that I could make it work with a “dirty” solution, but I am not able do that neither…