BehaviorTree.js icon indicating copy to clipboard operation
BehaviorTree.js copied to clipboard

it doesn't work in browser

Open sunq0001 opened this issue 5 years ago • 3 comments

i tried import the module into browser by webpack4 as below import { BehaviorTree, Sequence, Task, SUCCESS, FAILURE } from 'behaviortree'

once i want to check by console.log(BehaviorTree), console shows undefined.

when i tried this way import { BehaviorTree, Sequence, Task, SUCCESS, FAILURE } from '../node_modules/behaviortree/dist/index.node' it can work.

but when i tried import { BehaviorTree, Sequence, Task, SUCCESS, FAILURE } from '../node_modules/behaviortree/dist/index' it doesn't work.

it seems that this package can only be used in Node, but not applied for web.

sunq0001 avatar Sep 25 '20 15:09 sunq0001

I am not quite sure how your setup looks like, but you most likely would need a precompilation step, like using Webpack. If that is the case I don't see a reason why it shouldn't work.

Calamari avatar Apr 13 '21 09:04 Calamari

I can't get this imported into a TypeScript+Webpack project... We need a .d.ts file.

alekop avatar Jun 05 '22 16:06 alekop

Hey @alekop . Please try the typescript branch, which will be the base for the next release. That should work, and if it does not, please tell me, what error you get, so we can resolve that together.

Calamari avatar Jun 07 '22 09:06 Calamari