`typeof process === "object"` shoud be replaced during dependencies build
See original GitHub issueDescribe the bug
While using jotai I noticed it was running on production mode, so I did some research and discovered it uses typeof process === "object"
to detect NODE_ENV. Although process.env.NODE_ENV
is replaced during build, this specific pharse is not replaced.
Reproduction
Unsure, but try installing jotai and inspect its built sources inside node_modules/.vite
System Info
Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:
System:
OS: Windows 10 10.0.21387
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 8.47 GB / 23.72 GB
Binaries:
Node: 15.9.0 - ~\AppData\Local\Temp\xfs-22be641e\node.EXE
Yarn: 2.4.1 - ~\AppData\Local\Temp\xfs-22be641e\yarn.EXE
npm: 7.5.3 - ~\scoop\apps\nvm\current\nodejs\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.21387.1.0), Chromium (90.0.818.66)
Internet Explorer: 11.0.21387.1
Since it looks like envinfo
doesn’t support PnP, My vite version is 2.3.3.
Used package manager: yarn berry, but this shouldn’t be an issue here.
Before submitting the issue, please make sure you do the following
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Provide a description in this issue that describes the bug.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Replacing Real Dependencies with Test Doubles - GitHub
replaceEsm always returns an object that contains the doubles of the named exports of the module, and if the module has a default...
Read more >Dependencies Among Schema Objects
When a referenced object is modified, Oracle uses the depends-on table to identify dependent objects, which are then invalidated. For example, assume that...
Read more >Setting Up Dependency Injection with TypeScript in an Object ...
At the end of this post, you will learn what dependency injection is useful for, how to set it up in your TypeScript...
Read more >A quick intro to Dependency Injection - freeCodeCamp
In software engineering, dependency injection is a technique whereby one object (or static method) supplies the dependencies of another ...
Read more >How to manage build dependencies - IBM
Indirect build dependencies define relationships between the program source and the outputs from previous build processes. While indirect dependencies are not ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I closed it as mentioned by Sodatea,
jotai
should make the check better and the application works fine and as expected with vite. please open the issue onjotai
side so they can improve the checkI didn’t mean it straight out doesn’t work but always falling back to production mode. However, I agree with the comment above that this should be solved on
jotai
’s side, so it is appropriate to close it anyway.