Skip to content

Upgrade chokidar to fix Nuxt 4 Nitro build #890

@twinkelmann

Description

@twinkelmann

I recently upgraded @nuxt/ui to version 4, which uses your package unplugin-vue-components version 29.1.0.

This pulls a dependency for chokidar version 3.6.0, which itself pulls a dependency for anymatch 3.1.3, which itself pulls a dependency for a very outdated version of picomatch, version 2.3.1, before they removed the dependency on the "path" nodejs library.

This causes the following error when building a Nuxt 4 project:

ℹ Building Nuxt Nitro server (preset: cloudflare-pages, compatibility date: 2025-03-01)                          nitro 16:34:16
node_modules/.pnpm/mime@4.1.0/node_modules/mime/dist/src/Mime.js (1:30): The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
node_modules/.pnpm/mime@4.1.0/node_modules/mime/dist/src/Mime.js (1:38): The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js (2:7): Error when using sourcemap for reporting an error: Can't resolve original location of error.

[nitro 16:34:33]  ERROR  RollupError: node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js (2:7): "default" is not exported by "node:path?commonjs-external", imported by "node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js".


1: import * as commonjsHelpers from "commonjsHelpers.js";
2: import require$$0 from "\u0000node:path?commonjs-external";
          ^
3: 
4: 'use strict';

anymatch has not been updated in 3 years, so this is to be expected. However, chokidar version 4 dropped all dependencies except one, including the drop of anymatch.

I don't know how no one else got this error, but I think it would be beneficial for everyone if your project upgraded to chokidar version 4.

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