Skip to content

[Bug]: require() of ES Module fs-extra/lib/esm.mjs is not supported #1339

@giavinh79

Description

@giavinh79

Version

Current setup, without upgrading Rsdoctor to v1.3.x -

  System:
    OS: macOS 15.7
    CPU: (10) arm64 Apple M1 Pro
    Memory: 5.63 GB / 32.00 GB
    Shell: 5.9 - /opt/homebrew/bin/zsh
  Browsers:
    Chrome: 140.0.7339.214
    Edge: 140.0.3485.94
    Safari: 18.6
  npmPackages:
    @rsdoctor/rspack-plugin: 1.2.3 => 1.2.3

Details

I noticed that starting in v1.3.0 I get this error when I try to build:

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/project/node_modules/.pnpm/[email protected]/node_modules/fs-extra/lib/esm.mjs not supported.
Instead change the require of /Users/project/node_modules/.pnpm/[email protected]/node_modules/fs-extra/lib/esm.mjs to a dynamic import() which is available in all CommonJS modules.
    at /Users/project/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]_@swc+core@_29e83cc29f002201635812ee57038ff8/node_modules/@rsdoctor/core/dist/build-utils/build/utils/loader.cjs:67:33
    at Object.<anonymous> (/Users/project/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]_@swc+core@_29e83cc29f002201635812ee57038ff8/node_modules/@rsdoctor/core/dist/build-utils/build/utils/loader.cjs:333:3)
    at require.extensions.<computed> [as .js] (/Users/project/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]__@[email protected][email protected]/node_modules/ts-node/dist/index.js:851:20) {
  code: 'ERR_REQUIRE_ESM'
}
Warning: command "rspack --env stage=test" exited with non-zero status code

Reproduce link

N/A

Reproduce Steps

Just ran the same build command but now on v1.3.x of "@rsdoctor/rspack-plugin"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions