[Vuejs]-Unity WebGL Build Won't Even Appear in Nuxt/Vue App – Could not find a declaration file for module 'unity-webgl'

1👍

The fix was to move the "Build" folder into "static." Don’t forget to change the path of the game files in the UnityWebgl creation like this:

const Unity = new UnityWebgl({
  loaderUrl: '/Build/look-away-webGLbuild1-uncomp.loader.js',
  dataUrl: '/Build/look-away-webGLbuild1-uncomp.data',
  frameworkUrl: '/Build/look-away-webGLbuild1-uncomp.framework.js',
  codeUrl: '/Build/look-away-webGLbuild1-uncomp.wasm',
})

Also the developer that spotted this fix pointed out that if you don’t change ssr: true, to ssr: false, in nuxt.config.js, the window parameter in the look-away-webGLbuild1-uncomp.loader.js will be underfined. This makes it so that when you refresh the page you get this error:
enter image description here

Leave a comment