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.

Having to add `resolve` node packages to avoid polyfill?

See original GitHub issue

Hi,

I had to add buffer and other node packages to resolve otherwise it was converting it to ArrayBuffer. I use node libraries in the renderer.

 renderer: {
              resolve() {
                  return [
                      "bw-casclib", "events", "util", "fs/promises", "stream", "buffer", "string_decoder"
                  ]
              }
          },

I find my case to be strange because I believe vite no longer automatically polyfills, so I must be doing something wrong? I’m additionally getting issues around this kind of thing and I’m not certain why.

image

Above I will also now need to include url and zlib to the resolves. Is this as designed or am I doing something wrong?

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
alexpinedacommented, Sep 27, 2022

seems like I needed the esmodule but I don’t know why. probably just for the last one libnpmsearch.

        esmodule(["minipass-fetch", "make-fetch-happen", "libnpmsearch"]),
0reactions
caoxiemeihaocommented, Oct 4, 2022

Try a new plugin? These problems will disappear 🚀 https://github.com/electron-vite/vite-electron-plugin

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Polyfill node core modules in webpack 5
This was resolved simply by installing the buffer package with npm install -D buffer . 'fs'. Module not found: Error: Can't resolve 'fs ......
Read more >
BREAKING CHANGE: webpack < 5 used to include polyfills ...
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case.
Read more >
How to polyfill node core modules in webpack 5 - Alchemy
The main issue with create-react-app and the polyfill error is that create-react-app, by default, hides the webpack config file inside the node- ...
Read more >
How to Polyfill node core modules in webpack 5.
Webpack 5 is in beta and my company decided to switch to it. So I went head-on with the task at hand. Following...
Read more >
if you don't want to include a polyfill, you can use an empty ...
node.js - How to Polyfill node core modules in webpack 5 - Stack . ... I had a minor fix, I was able...
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