Skip to content

Module parse error after upgrading from cheerio v1.0.0-rc.12 to v1.0.0 in Nuxt (Webpack 4) environment #4459

@FireOnIcecube

Description

@FireOnIcecube

Description

After upgrading cheerio from v1.0.0-rc.12 to v1.0.0, I started seeing module parse errors in my Nuxt project. Reverting back to v1.0.0-rc.12 fixes the issue, so it seems specific to v1.0.0.

Error Logs

ERROR in /home/cooperwang/projects/web-project/node_modules/.pnpm/node_modules/encoding-sniffer/dist/commonjs/index.js Module not found: Error: Can't resolve 'node:stream' in '/home/cooperwang/projects/web-project/node_modules/.pnpm/node_modules/encoding-sniffer/dist/commonjs'

ERROR in /home/cooperwang/projects/web-project/node_modules/.pnpm/node_modules/parse5-parser-stream/dist/index.js Module not found: Error: Can't resolve 'node:stream' in '/home/cooperwang/projects/web-project/node_modules/.pnpm/node_modules/parse5-parser-stream/dist'

ERROR in ./node_modules/cheerio/dist/esm/index.js Module not found: Error: Can't resolve 'node:stream' in '/home/cooperwang/projects/web-project/sites/w12/node_modules/cheerio/dist/esm'

ERROR in /home/cooperwang/projects/web-project/node_modules/.pnpm/node_modules/undici/index.js 123:39 Module parse failed: Unexpected token (123:39) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See
https://webpack.js.org/concepts#loaders

Steps to Reproduce

  1. Install or upgrade to [email protected] in a Nuxt 2 project using Webpack 4.
  2. Run pnpm run dev or pnpm run build.
  3. Observe the module parse errors above.

Expected Behavior

The build should succeed without errors, as it does when using [email protected].

Environment

  • Operating System: Linux
  • Node Version: v20.12.2
  • Nuxt Version: 2.17.4
  • CLI Version: 3.22.5
  • Nitro Version: -
  • Package Manager: [email protected]
  • Builder: webpack 4.47.0
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Additional Context

Any guidance or workaround would be greatly appreciated. Thank you!

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