bridge icon indicating copy to clipboard operation
bridge copied to clipboard

Using process.env variables in app.html

Open iandevlin opened this issue 2 years ago • 4 comments

I have a Nuxt 2.17.1 project which uses an app.html file to define various things.

Within that app.html file it accesses variables like process.env.CDN_PATH to load such things as fonts from a CDN.

These appear to be completely inaccessible with Nuxt Bridge.

Can anyone tell me how to get these environment variables to work in this case?

And if it's not possible, first of all why, and secondly, what would be an alternative method? I cannot find anything at all in the documentation with regards to this.

Thanks in advance.

iandevlin avatar Aug 16 '23 16:08 iandevlin

I'll have a look. would you provide a minimal reproduction?

danielroe avatar Aug 17 '23 08:08 danielroe

Unfortunately that's not possible at the moment, but the simple fact that you didn't reply with "oh no that won't work because of X" tells me that it should be possible to access process.env variables in a HTML file.

iandevlin avatar Aug 17 '23 09:08 iandevlin

Well, honestly half the reason I asked was that it really doesn't seem like that should work.

danielroe avatar Aug 17 '23 13:08 danielroe

Ah ok, interesting, it works fine with Nuxt 2, but perhaps it's a webpack thing.

iandevlin avatar Aug 17 '23 13:08 iandevlin

Close as no further investigation is possible as no reproduction is available. If it is still occurring, please create a reproduction.

wattanx avatar Aug 31 '24 02:08 wattanx