Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: require() of ES Module, NextJS #18

Closed
0xAndrei opened this issue May 29, 2022 · 6 comments
Closed

Error: require() of ES Module, NextJS #18

0xAndrei opened this issue May 29, 2022 · 6 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@0xAndrei
Copy link

Getting:

Error: require() of ES Module E:\skinview3d\myapp\node_modules\skinview3d\libs\skinview3d.js from E:\skinview3d\myapp\node_modules\react-skinview3d\dist\index.js not supported.
Instead change the require of skinview3d.js in E:\skinview3d\myapp\node_modules\react-skinview3d\dist\index.js to a dynamic import() which is available in all CommonJS modules.

With react-skinview3d whilst using NextJS

Sandbox:

https://codesandbox.io/s/determined-varahamihira-62ms17?file=/pages/index.js

@Hacksore Hacksore added bug Something isn't working good first issue Good for newcomers labels Jun 1, 2022
@Hacksore
Copy link
Owner

Hacksore commented Jun 1, 2022

I don't have the bandwidth right now but if anyone has time to look into this and raise a PR I'd be happy to review and merge.

Might be something @g-plane could provide some insight to.

The upstream issue for the framework bindings bs-community/skinview3d#107

@0xAndrei
Copy link
Author

0xAndrei commented Jun 6, 2022

ok

@Hacksore
Copy link
Owner

This seems like a working solution from my minimal testing.
https://codesandbox.io/s/react-skinview3d-next-esm-7n2eh1?file=/pages/index.js

Followed this thread vercel/next.js#25454

@Hacksore
Copy link
Owner

Gonna close this out and if the issue still persists please raise another issue.

@0xAndrei
Copy link
Author

yes, this works for me too 👍! but i have a question.

Can you use controls with JS (not TypeScript)?

im getting "ReferenceError: skinview3d is not defined" when using
let control = skinview3d.createOrbitControls(skinViewer);

after importing skinview3d

im getting "TypeError: skinview3d.createOrbitControls is not a function"

@Hacksore
Copy link
Owner

@andreihalt I've updated the codesandbox to show how. You need to install skinview3d as those functions don't exist in this wrapper lib.

https://codesandbox.io/s/react-skinview3d-next-esm-7n2eh1?file=/pages/index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants