We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Error Using v3d module import in react

Home Forums Programming Error Using v3d module import in react

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #36817
    shantiscript
    Customer

    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
    #36821
    #36823
    shantiscript
    Customer

    Yes. 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

    #36842

    I guess this is not supported yet. :scratch:

    Chief 3D Verger | LinkedIn | Twitter

    #36844
    shantiscript
    Customer

    Sorry 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?

    #37178
    caseyjhol
    Participant

    It 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.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.