Skip to content

Browser build uses nodejs modules, will break with webpack 5, breaks with rollup/vite #8130

Closed
@jbjorge

Description

@jbjorge

Issue

Hi!
I've recently switched from webpack to vite.
I'm running into a problem with rollup reporting
Dependency pouchdb-browser is attempting to import Node built-in module 'events'.

According to Evan You (the creator of Vue and Vite), the automatic bundling of nodejs packages will also stop working in webpack 5.

I've had a look at creating a PR to add a polyfill for the nodejs packages and add it to the browser field of the relevant package.json files so it picks up the correct polyfills, but I have a hard time figuring out the best way of doing it.

How would we best go about fixing this issue?

Info

  • Environment: browser
  • Build system: webpack 5/rollup/vite

Reproduce

npm init vite-app testApp
cd testApp
npm i && npm i pouchdb-browser
npm run dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions