I’m working on a JavaScript website, and had it working for a few days. Until I added a new dependency today, and now I am getting JS errors in the console.
In my package.json, under dependencies, I added a new one:
"dompurify": "^2.0.8"
And then in my site’s code I use this new package:
import purify from "DOMPurify";
purify.sanitize(html);
Locally, everything works great. No errors while in dev mode, no errors when I create a production build either. But when I deploy my site to Netlify and it creates a build, I get an error saying ReferenceError: Can't find variable: purify when I open the site.
I tried to rebuild without cache, but that didn’t help. What else could it be?