Cannot bundle Node.js built-in "node:http" while vite build
See original GitHub issueI am working on Vite v3.0.9 and using node-fetch 3.2.10. I used doc to import node-fetch (see screen)
While build I have next issue
Current Behavior

Expected Behavior Successful build
Your Environment
software | version |
---|---|
node-fetch | 3.2.10 |
node | 18.12.0 |
npm | 8.19.2 |
Operating System |
Additional context
I’ve already tried workaround with replacing node:http
into http
But than I have the same error but with just http
module
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Troubleshooting - Vite
As Vite does not bundle most of the files, browsers may request many ... This is because Node.js limits request header size to...
Read more >Node.js v19.3.0 Documentation
All instances contain the built-in Error properties ( message and name ) and: actual <any> Set to the actual argument for methods such...
Read more >Polyfill Node.js built-in modules with Vite - Medium
A build command that bundles your code with Rollup, pre-configured to output highly optimized static assets for production. It's very similar to Snowpack...
Read more >Deploying a new nuxt 3 app result to error - Support
Hello, I've created a new nuxt 3 app and tried to delopy it to netlify with github: stoic-fermat-995d10 The build stop when It...
Read more >How do I resolve "Cannot find module" error using Node.js?
I don't know how typical this is, but faye creates a build directory when it is built and puts a copy of package.json...
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
Seems like it’s trying to make it a NodeJS dependency free version so that it do not rely on any NodeJS stuff
so even if you only have
import fs from 'fs'
in your codebase it would fail? maybe you need change some setting to not bundle built in NodeJS core modules?Also maybe it will help Just created minimal repo https://github.com/supproduction/vite-node-fetch
npm i npm run build