Tippy.js: "Uncaught ReferenceError: process is not defined" when running with importmaps in Rails 8 with no bundler

I’ve updated my application to rails 8 running with propshaft and the importmap-rails gem instead of webpacker. I am still using yarn to manage dependencies and pinning them in my importmap. Works great except I ran into this error with tippy.js. I successfully pinned and imported it with all dependencies (there were a lot, but it works).

But then the browser hits this error. I believe it’s because tippy.js is expecting a bundler like webpacker to strip out any mentions of process.env, which are only used for logging. Does anyone know a way around this?

Here is my code:

# from config/importmap.rb

pin "tippy", to: "tippy.js/dist/tippy.esm.js"

# various dependencies pinned here...
	pin "/assets/@popperjs/core/dist/esm/dom-utils/isLayoutViewport.js", to: "@popperjs/core/dist/esm/dom-utils/isLayoutViewport.js"
	pin "/assets/@popperjs/core/dist/esm/dom-utils/getWindowScroll.js", to: "@popperjs/core/dist/esm/dom-utils/getWindowScroll.js"
	pin "/assets/@popperjs/core/dist/esm/dom-utils/getHTMLElementScroll.js", to: "@popperjs/core/dist/esm/dom-utils/getHTMLElementScroll.js"
// from application.js
import tippy from 'tippy';

Then in the browser console, only one error:

Uncaught ReferenceError: process is not defined
    at validation.ts:46:1

The line in question looks like this:

if (__DEV__) {

Here are the issues I’ve found documenting the error for reference:

They recommend a polyfill but I haven’t been able to get that to work. I tried adding this to my application.js file:

window.process = { env: { NODE_ENV: 'development' }}

Still got the same error. Also tried adding an environment variable for NODE_ENV to my bash profile and restarting my rails server, no luck there either.

Thanks in advance!