pmndrs / ecctrl

🕹ī¸ A floating rigibody character controller
MIT License
467 stars 50 forks source link

Fails to work with NextJs #5

Closed Magvin closed 9 months ago

Magvin commented 9 months ago

Any suggestions, would be highly appreciated

Magvin commented 9 months ago

UPD: when i'm trying to do it via 'transpilePackages' in next.config.js in complains about three.js

image
ecaii commented 9 months ago

I had the same issue, I resolved it by adding ecctrl to the transpilePackages in next.config.js.

Such as const nextConfig = { transpilePackages: ['three', 'ecctrl'], }

Magvin commented 9 months ago

tried, three complains then. what version of Next you are using?

ecaii commented 9 months ago

There. "ecctrl": "^1.0.25", "next": "13.4.19", "three": "^0.156.1", "react": "18.2.0", "react-dom": "18.2.0",

What is three complaining about ?

ErdongChen-Andrew commented 9 months ago

😱 I've encountered a similar issue when using the npm package with 'create-react-app.' However, when I run the package locally, everything works fine. I will take some time to figure this out and make the necessary adjustments. 😅

Magvin commented 9 months ago

@ecaii ah ok we are still on 13.2.4, This is issue is within nextjstranspilePackage they have fixed it on 13.4v. I think easier @ErdongChen-Andrew is just to ship dist folder fully compiled as npm module

ErdongChen-Andrew commented 9 months ago

Thanks @Magvin , I ended up generating different versions of the main file and publishing the dist folder. This resolved all the errors, and now everything works smoothly 😁.

Magvin commented 9 months ago

Legend thanks