Bug description
When @superset-ui/core resolves to d3-scale@4, the dev build fails at runtime with:
Screenshots/recordings
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Comment From: dosubot[bot]
Hi @chlonn! I'm Dosu and I’m helping the superset team.
This error is happening because d3-scale v4 switched to ES modules by adding "type": "module"
in its package, which can break builds expecting CommonJS modules and result in ReferenceError: module is not defined
at runtime if your build tooling isn't configured for ESM compatibility. The upgrade to d3-scale@4 was made very recently in Superset's @superset-ui/core dependency (PR #31534), and there isn't any documented workaround or code-level fix for this issue in the repo yet.
To work around this, you can try pinning d3-scale to v3 in your dependencies, or update your build configuration (webpack, Babel, etc.) to fully support ESM packages. If you need to revert, set d3-scale to ^3.3.0
in your package.json and run a clean install. If you want to use v4, make sure your build tools are set up for ESM imports throughout your frontend stack.
Let me know if you need help with specific build config changes or troubleshooting the pinning process.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
Comment From: msyavuz
I remember encountering something like this, it should be fixed by running npm ci
in a clean repo. Let me know if that helps, if not we might have a dependency issue there
Comment From: rusackas
If doing this ^^^ changes the package-lock.json file for some reason (bumping a sub-dependency or something... I'm not sure, as I haven't encountered this) then feel free to open a PR with the changes.
Comment From: chlonn
I currently managed to compile successfully by referring to [this issue](https://github.com/apache/superset/issues/28557).