@cubejs-client/core: package.json is missing @babel/runtime as a declared dependency

Open Beginner friendly
#10,952 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
javascript
Domain
build-system

Research direction

Start with packages/cubejs-client-core/package.json and inspect the published dist/cubejs-client-core.cjs.js references to @babel/runtime/helpers. Add the missing runtime dependency or adjust the build as appropriate, then reproduce with the provided production npm install and node require command; done means the package loads without MODULE_NOT_FOUND in a clean production install.

Written by the indexing model from the issue text.

Description

Summary

@cubejs-client/core (every version on npm I checked, latest 1.6.51 included) ships a precompiled CommonJS bundle (dist/cubejs-client-core.cjs.js) that calls require('@babel/runtime/helpers/...') for 16 different helpers at load time, but the package's dependencies block does not declare @babel/runtime.

In any consumer environment where @babel/runtime is not pulled in as a transitive of some other dependency — e.g. a pnpm install --prod (devDeps pruned), a fresh npm install in a clean tree, or yarn 3 PnP — Node throws MODULE_NOT_FOUND: Cannot find module '@babel/runtime/helpers/<helper>' the moment the consumer references any value (not just types) from @cubejs-client/core.

This appears to be the same defect reported in #5670 in 2022 (closed as question without a fix). The packaging issue persists across 22 patch releases since.

Reproduction

mkdir cubejs-repro && cd cubejs-repro
echo '{"name":"repro","private":true,"dependencies":{"@cubejs-client/core":"^1.6.51"}}' > package.json

# Production install — no devDeps, no incidental hoists.
npm install --omit=dev
node -e "require('@cubejs-client/core')"

Output:

Error: Cannot find module '@babel/runtime/helpers/toArray'
Require stack:
- .../node_modules/@cubejs-client/core/dist/cubejs-client-core.cjs.js

In dev installs, @babel/runtime typically gets pulled in as a transitive of some unrelated devDep (in our case, concurrently → date-fns → @babel/runtime) and the issue is masked. The first production deploy with a value import of the package surfaces it.

Compiled requires

$ grep -oE "@babel/runtime/helpers/[a-zA-Z]+" \
    node_modules/@cubejs-client/core/dist/cubejs-client-core.cjs.js | sort -u
@babel/runtime/helpers/asyncToGenerator
@babel/runtime/helpers/awaitAsyncGenerator
@babel/runtime/helpers/classCallCheck
@babel/runtime/helpers/createClass
@babel/runtime/helpers/defineProperty
@babel/runtime/helpers/getPrototypeOf
@babel/runtime/helpers/inherits
@babel/runtime/helpers/objectWithoutProperties
@babel/runtime/helpers/possibleConstructorReturn
@babel/runtime/helpers/readOnlyError
@babel/runtime/helpers/slicedToArray
@babel/runtime/helpers/toArray
@babel/runtime/helpers/toConsumableArray
@babel/runtime/helpers/typeof
@babel/runtime/helpers/wrapAsyncGenerator
@babel/runtime/helpers/wrapNativeSuper

@cubejs-client/core@1.6.51 dependencies (current npm view):

core-js, cross-fetch, d3-format, d3-time-format, dayjs, ramda,
url-search-params-polyfill, uuid

No @babel/runtime.

Expected

@babel/runtime is declared as a runtime dependency of @cubejs-client/core (or the build is changed so that the compiled output does not require it).

Suggested fix

The compiled output references @babel/runtime/helpers/*, which is the signature of @babel/plugin-transform-runtime injecting runtime helpers. Add @babel/runtime to dependencies in packages/cubejs-client-core/package.json (matching the version used at build time, or ^7 as a floor).

Consumers can work around this in pnpm using pnpm.packageExtensions:

# pnpm-workspace.yaml
packageExtensions:
  '@cubejs-client/core':
    dependencies:
      '@babel/runtime': ^7.22.5

…but this should not be necessary; the package's own package.json should declare what it requires at runtime.

Environment

  • @cubejs-client/core: 1.6.29 (verified same defect in latest 1.6.51 via npm view)
  • Node: 24.x
  • Package manager: pnpm 11 with pnpm install --prod --frozen-lockfile
Dominant language
Rust
Stars
20.9k
Forks
2.1k
Avg merge
1d 31m
Merged PRs (30d)
203

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cube-js/cube

All issues in cube-js/cube

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.