How to use library mode with process env #14474
Unanswered
andredewaard
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Fixed with: define: {
'process.env.PROD': `"${process.env.NODE_ENV === 'development' ? 'false' : 'true'}"`,
'process.env.VITE_BUGSNAG_KEY': `"${process.env.VITE_BUGSNAG_KEY}"`
}, Would be nice if these is something that adds all .env variables into your process.env automatically. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I'm also interested, trying to use the https://github.com/abandonware/noble lib in both nodejs and a browser, and it doesn't compile in the browser because one of the dependency is trying to access |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wrote a small library we use internally which i want it to use the .env variables from the consuming project.
https://vitejs.dev/guide/build.html#library-mode explains that you can use 'process.env.' in your library.
What is the best way to do this?
I get an
Uncaught ReferenceError: process is not defined
errorThis is the code i use in the library
What should i add to use this in the consuming project?
This doesnt seem to work:
Beta Was this translation helpful? Give feedback.
All reactions