Skip to content

[BUG] ESM - Usage with module-federation #1423

@Potof-TheOz

Description

@Potof-TheOz

Hi react-dropzone community !! 👋

Describe the bug
Since the version 14.3.7, when I try to share this deps (react-dropzone), Webpack responds with this warning in the console:

WARNING in consume shared module (default) react-dropzone@14.3.7 (strict) (fallback: /.../node_modules/.pnpm/react-dropzone@14.3.7_react@19.0.0/node_modules/react-dropzone/dist/es/index.js)
  ⚠ No version specified and unable to automatically determine one. No version in description file (usually package.json). Add version to description file /.../node_modules/.pnpm/react-dropzone@14.3.7_react@19.0.0/node_modules/react-dropzone/dist/es, or manually specify version in shared config. shared module react-dropzone -> /.../node_modules/.pnpm/react-dropzone@14.3.7_react@19.0.0/node_modules/react-dropzone/dist/es/index.js

I investigated on your repo and noticed that since this version (14.3.7) there is a special build for ESM

"build:es-package": "echo '{\"type\":\"module\"}' > dist/es/package.json",

That's weird because now, in my node_modules, I have this package.json

node_modules/.pnpm/react-dropzone@14.3.8_react@19.0.0/node_modules/react-dropzone/dist/es/package.json

{"type":"module"}

Of course Webpack is not able to get the proper version of this module.

I think there is an issue when building for ESM, maybe you just wanted to add the "module":true, in your built package.json.

To Reproduce
no need for reproduction, you can find the issue here: https://www.npmjs.com/package/react-dropzone?activeTab=code

and navigate here: /react-dropzone/dist/es/package.json

Expected behavior
Have a complete package.json available for ES module.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS
  • Browser N/A
  • Version N/A

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions