Dieter's Words

Tippy.js with importmaps

Published  

So there I was, writing code when all of a sudden it hit me, an error when trying to use tippy with importmaps. It looks for the current NODE_ENV in the process variable to provide some handy warnings etc.

As we all know process does not exist when in the browser so we have to fake it. You can get tippy working by adding a line of JavaScript as the first script tag. You ready for it? Here it is:

<script>
window.process = { env: { NODE_ENV: "development" } }
</script>

That’s it. I know, you were expecting some magic spell or incantation but there isn’t much needed to trick tippy into thinking it is running on node instead of in a browser. Remember to tip your waiter.

Dieter Lunn

© DYNABLOGGER.COM
powered by DynaBlogger