what is the right way to use functions from js file?
Hi, Im using grained.js which is supplied from a grained.js file, I have the file imported through my head in my nuxt.config.ts, However whenever I want to use the grained function nuxt almost always returns a 500 error. What am I doing wrong here?
grained.js:
https://github.com/sarathsaleem/grained/blob/master/grained.js
GitHub
grained/grained.js at master · sarathsaleem/grained
Generate animated noise texture with grained.js. Contribute to sarathsaleem/grained development by creating an account on GitHub.
2 Replies
putting the function in a created or setup also returns a 500, however putting it above the export makes it sometimes returns a 500
right now I fixed it by calling the function after a promise
The easiest would be to import the JS file at build time and not add it via script tag
Also be aware to call it in onMounted if it interacts with the dom