Skip to content

Failed to resolve import "vite-plugin-node-polyfills/shims/buffer" #81

@OliverWich

Description

@OliverWich

When using a version higher than 0.17.0, and polyfilling a bunch of stuff (see vite config snippet below), I get the following error:
image

The relevant section of my vite config is this:

"plugins": [
// ...
 nodePolyfills({
      globals: {
        Buffer: true,
        global: true,
        process: true,
      },
      include: [
        'fs',
        'path',
        'crypto',
        'stream',
        'util',
        'http',
        'https',
      ],
    }),
// ...
]

With this config everything works fine in 0.17.0 but in the testet versions 0.19.0 and 0.21.0 the error occurs

When trying to include "buffer" in the include array, it also fails because there is no polyfill for it (or it gets already polyfilled by the globals section above).
( ERROR: [plugin: node-stdlib-browser-alias] Cannot find module 'vite-plugin-node-polyfills/shims/buffer' from '.')

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing reproductionThis issue does not provide a reproducible example of the problem.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions