Home › Forums › Programming › Error Using v3d module import in react
- This topic has 5 replies, 3 voices, and was last updated 3 years, 11 months ago by caseyjhol.
-
AuthorPosts
-
2020-12-22 at 9:43 am #36817shantiscriptCustomer
Hi, i am trying to move from the suggested way of implementing verge3d in react by using a script tag import in index.html to using ES modules from the v3d.module.js.
when importing all of the modules in app.js using
import * as v3d from "./v3d.module";
im am getting a long chain of errors. I would like to move to using es imports so i can use three shaking in order to reduce bundle size.
Line 1:29: Expected an assignment or function call and instead saw an expression no-unused-expressions Line 1:1267: Expected an assignment or function call and instead saw an expression no-unused-expressions
there are about a hundred or more of these errors on different lines. And then there are more specific ones:
Line 1:56335: '__v3d_DEVTOOLS__' is not defined no-undef Line 1:105996: Unexpected use of 'self' no-restricted-globals Line 1:558585: 'WebGL2ComputeRenderingContext' is not defined no-undef Line 1:660599: 'polyfill' is not defined no-undef Line 1:660619: 'WebXRPolyfill' is not defined no-undef Line 1:660665: 'polyfill' is not defined no-undef Line 1:660766: 'polyfill' is not defined no-undef Line 1:660786: 'WebXRPolyfill' is not defined no-undef Line 1:667800: 'XRSession' is not defined no-undef Line 1:668005: 'XRRay' is not defined no-undef Line 3:55851: 'cos' is not defined no-undef Line 3:55883: 'cos' is not defined no-undef Line 3:55901: 'cos' is not defined no-undef Line 3:55973: 'sin' is not defined no-undef Line 3:55980: 'cube' is not defined no-undef Line 3:56003: 'cos' is not defined no-undef Line 3:417822: 'read' is not defined no-undef Line 3:417939: 'readbuffer' is not defined no-undef Line 3:417981: 'read' is not defined no-undef Line 3:418046: 'scriptArgs' is not defined no-undef Line 3:418100: 'arguments' is not defined no-undef Line 3:418131: Unexpected use of 'print' no-restricted-globals Line 3:418193: Unexpected use of 'print' no-restricted-globals Line 3:418255: 'printErr' is not defined no-undef Line 3:418264: Unexpected use of 'print' no-restricted-globals Line 3:418356: Unexpected use of 'self' no-restricted-globals Line 3:546110: 'polyfill' is not defined no-undef Line 3:546130: 'WebXRPolyfill' is not defined no-undef Line 3:534743: Unexpected use of 'self' no-restricted-globals Line 3:534761: Unexpected use of 'self' no-restricted-globals Line 3:589105: 'Ammo' is not defined no-undef Line 3:616264: 'REVISION' is not defined no-undef
2020-12-22 at 10:05 am #36821Yuri KovelenovStaffHi,
have you seen this? https://www.soft8soft.com/docs/manual/en/programmers_guide/Integration-with-Reactjs-Vuejs.html
2020-12-22 at 11:37 am #36823shantiscriptCustomerYes. I have been working with the integration described in the link for a while now without problems. But i am trying to improve the provided integration by moving to import statements directly in app.js
In the template the verge3D library is imported by using a script tag in index.html
Under step 4.)
<script src="%PUBLIC_URL%/v3d.js"></script>
Instead of that i am trying to import the verge3d modules from v3d.module.js (which should provide verge3d as modules that can be imported) directly in app.js
2020-12-23 at 8:58 am #36842Yuri KovelenovStaff2020-12-23 at 11:17 am #36844shantiscriptCustomerSorry what do you mean with guess? Is it supported or not?
And if its not supported yet, what is the function of the module file?2021-01-08 at 7:10 pm #37178caseyjholParticipantIt would be great to find a solution for this. Considering the minified v3d.js is over 1MB, it seems crazy to insert it on index.html.
-
AuthorPosts
- You must be logged in to reply to this topic.