Uncaught SyntaxError: Unexpected token '<' #348
-
Hello, My errors are :
I know that these errors are common but the weird thing is depending where is use my component, sometime i have the error and sometimes not. I have my webgl project correctly set inside the public folder like follow
In my js file, i create my unity context like follow : And i display it like that : The errors DO NOT OCCUR when I use the component in a function or class that has a short path (either the root or juste one field like /home or /user) This is a really weird problem, i use exactly the same code but it doesn't work in every file, the length of the url path is the only thing I found that differ in the 2 different cases Any hint i can get to resolve that ? Thanks in advance Louis |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I HAVE FOUND THE ISSUE I hope that can help you |
Beta Was this translation helpful? Give feedback.
I HAVE FOUND THE ISSUE
I am so sorry, I was looking for 2 days after a solution
And with writing that question that helped me defining the problem.
The url path was indeed the problem
if the path is root or /field, that works correctly
if the path is longer, like /user/account, you have to add ../
Like that
const unityContext = new UnityContext({
loaderUrl: "./../FallingGame/Build/FallingGame.loader.js",
frameworkUrl: "./../FallingGame/Build/FallingGame.framework.js",
dataUrl: "./../FallingGame/Build/FallingGame.data",
codeUrl: "./../FallingGame/Build/FallingGame.wasm",
});
I hope that can help you