question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not compatible with Electron: Node.js internal modules truncated

See original GitHub issue

Describe the bug

Node.js internal modules were turned into empty objects. Which is valid and needed in Electron enviroments.

And, Node.js only means SSR is a false assumption.

Reproduction

require("utils").promisify()

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

  System:
    OS: macOS 11.2.3
    CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
    Memory: 157.62 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.5 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.6.3 - /usr/local/bin/npm
  Browsers:
    Chrome: 89.0.4389.128
    Firefox: 85.0.2
    Safari: 14.0.3
  npmPackages:
    @vitejs/plugin-vue: ^1.0.4 => 1.0.5 
    vite: ^2.0.0-beta.12 => 2.0.0-beta.26 

Used package manager: npm

Logs

 [vite] warning: externalized node built-in "child_process" to empty module. (imported by:


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:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
Niputicommented, Dec 18, 2021

a focus of vite is to promote esm. vite doesn’t/won’t support node global builtins/api’s on the client (browser) as they don’t exist with esm compliant code. you can use node global builtins/api’s in ssr since you are running node environment here

1reaction
Niputicommented, Dec 18, 2021

closing as vite is not going support node global builtins and node specific api’s on the client

Read more comments on GitHub >

github_iconTop Results From Across the Web

electron - Compiled against a different Node.js version using ...
I have tried execute npm rebuild and npm install . But this doesn't solve my problem. 20221029-Updated. This is my whole package.json. { ......
Read more >
Node.js v19.3.0 Documentation
The node:assert module provides a set of assertion functions for verifying invariants. Strict assertion mode#. History ...
Read more >
Deprecated APIs | Node.js v19.3.0 Documentation
A Documentation-only deprecation is one that is expressed only within the Node.js API docs. These generate no side-effects while running Node.js. Some ...
Read more >
Process | Node.js v19.3.0 Documentation
Normally, the Node.js process will exit when there is no work scheduled, but a listener ... 'SIGTERM' is not supported on Windows, it...
Read more >
Timers | Node.js v19.3.0 Documentation
The timer module exposes a global API for scheduling functions to be called at some future period of time. Because the timer functions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found