materialize
materialize copied to clipboard
Cannot use 'in' operator to search for 'Array'
Hi. I've added materializecss to my vite project and getting this error when building my app
materialize.min.js:6 Uncaught TypeError: Cannot use 'in' operator to search for 'Array' in undefined
at Object.$jscomp.polyfill (materialize.min.js:6)
at materialize.min.js:6
The error is something in the anime
library.
Here's the deployed app with the error https://vitecoil.now.sh/ and here's a sample repo https://github.com/sorxrob/vite-coil-simulator
Any help would be much appreciated.
I've had the same issue when importing the .min.js file directly. It works when importing it as a dependency, but that doesn't allow me to change parts of the code. Have you found a solution for this yet, @wobsoriano?
I've had the same issue when importing the .min.js file directly. It works when importing it as a dependency, but that doesn't allow me to change parts of the code. Have you found a solution for this yet, @wobsoriano?
Have no idea now. I don't remember 😆
Just waiting for vuetify 3
I have the same problem with en vue3 using vite, someone has some solution
@juanvictorbascopecastro skip this one and use primevue with material theme
manage to solve the problem for materialize.js in line 1509 in vercion 1.0.0-rc.2 replace the following code p = $jscomp.global;e = e.split(".");for (m = 0; m < e.length - 1; m++) {
with let p = $jscomp.global;e = e.split("."); if(!p) p = new Array();for (m = 0; m < e.length - 1; m++) {
let p = $jscomp.global;e = e.split("."); if(!p) p = new Array();for (m = 0; m < e.length - 1; m++) { var u = e[m];u in p || (p[u] = {});p = p[u]; }e = e[e.length - 1];m = p[e];r = r(m);r != m && null != r && $jscomp.defineProperty(p, e, { configurable: !0, writable: !0, value: r });
I could not figure out how to apply the solution provided here so instead of modifying the materialize.js file in the Gems I created my own under a custom directory. I applied the change to the materialize.js file in my new dir and then applied the steps found here: https://stackoverflow.com/a/71303435/788322
I'm on a new Rails 7 app.
@ChidoYo Last update is 2020. I don't think it's wise to use this
@wobsoriano It's working for me and it cleared any errors on my console.
I used the solutions offered by @juanvictorbascopecastro on Sept 2022.
This is just an App I'm playing with so I'm ok continuing on. If you have a better approach on this please provide it. I'm open to suggestions.