-
So I just updated to Mobx v6.X and had issues with mobx complaining about the NODE_ENV not being set.... so after some searching the only option I found that actually works was to hard code this Here is a test web application to see what I'm talking about. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
Depends on whether you are using MobX using a script tag or a bundler.
Bundlers should take care of setting it, if you use a script tag, make sure
to pick the UMD build.
…On Wed, Jan 13, 2021 at 11:04 PM Jacob Miles ***@***.***> wrote:
So I just updated to Mobx v6.X and had issues with mobx complaining about
the NODE_ENV not being set.... so after some searching the only option I
found that actually works was to hard code this globalThis.process = {
env: { NODE_ENV: 'production' } }; in my index.html file. I can provide a
test application via zip file or github repo if needed. But, it does seem a
little unusual for have to set this value for a Web Application. Is there
another way to get this value set that I just don't know about that would
be better than hard coding it into the index.html file?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2714>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBGKACMGRNBWKRKKOCDSZYRIHANCNFSM4WBRSYFA>
.
|
Beta Was this translation helpful? Give feedback.
-
It is being imported like Here is the 'start' script in my package.json
|
Beta Was this translation helpful? Give feedback.
-
OK, I found a workaround (maybe a solution).... I can add a rollup plugin to @web/dev-server to inject the process.env.NODE_ENV, but this really seems like a hacky way of doing things. Also when bundling with rollup I also have to add this same plugin to get it to inject the process.env.NODE_ENV. |
Beta Was this translation helpful? Give feedback.
-
Rollup doesn't default to bundling modules for the web specifically. To
bundle for browser consumption, you will need to use either the prebuild
umd version of mobx, or use a webbundler like webpack or parcel, or indeed
further configure rollup with plugins. This is further working as intended,
as without this setup, bundlers wouldn't be able to pick separate versions
for prod or debug.
Op do 14 jan. 2021 21:38 schreef Jacob Miles <notifications@github.com>:
… OK, I found a workaround (maybe a solution).... I can add a rollup plugin
to @web/dev-server to inject the process.env.NODE_ENV, but this really
seems like a hacky way of doing things. Also when bundling with rollup I
also have to add this same plugin to get it to inject the
process.env.NODE_ENV.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2714 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBAFKRTDKQK6WL2ZQCLSZ5P5ZANCNFSM4WBRSYFA>
.
|
Beta Was this translation helpful? Give feedback.
OK, I found a workaround (maybe a solution).... I can add a rollup plugin to @web/dev-server to inject the process.env.NODE_ENV, but this really seems like a hacky way of doing things. Also when bundling with rollup I also have to add this same plugin to get it to inject the process.env.NODE_ENV.