Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export in JS utilities function #8885

Open
arkadiusz-swierczek-pm opened this issue Oct 30, 2024 · 3 comments
Open

Export in JS utilities function #8885

arkadiusz-swierczek-pm opened this issue Oct 30, 2024 · 3 comments
Assignees
Labels
question The issue is a question. Please use Stack Overflow for questions.

Comments

@arkadiusz-swierczek-pm
Copy link

arkadiusz-swierczek-pm commented Oct 30, 2024

Describe the bug
Using default export throws error on runtime: TypeError: Cannot read properties of null (reading 'declarations')

To Reproduce
Steps to reproduce the behavior:

  1. Create directory structure described in https://cube.dev/docs/product/data-modeling/dynamic/code-reusability-export-and-import#import-from-parent-directories
  2. Replace content of model/shared_utils/utils.js with
const _capitalize = (s) => s.charAt(0).toUpperCase() + s.slice(1);
export { _capitalize as capitalize }

Expected behavior
I am expecting to be able to use the default export without runtime error.

Version:
0.36.0

Additional context
I believe, that root case is located in packages/cubejs-schema-compiler/src/compiler/transpilers/ImportExportTranspiler.ts

@igorlukanin igorlukanin self-assigned this Nov 1, 2024
@igorlukanin igorlukanin added the question The issue is a question. Please use Stack Overflow for questions. label Nov 1, 2024
@igorlukanin
Copy link
Member

I am expecting to be able to use the default export without runtime error.

Hey @arkadiusz-swierczek-pm 👋 Could you please elaborate on this? Is there anything that you can not accomplish without default exports?

@arkadiusz-swierczek-pm
Copy link
Author

Hey

I made an error in the title and the description. The problem doesn't occured when using default export, but named export.

I have created minimal example showing how to get the error: https://github.com/arkadiusz-swierczek-pm/cube-8885,
and also PR: #8774

Please also take a look at the link:, that show another way to get the error https://astexplorer.net/#/gist/c9de828dbc29e8df9bf88e8a58c58842/4ef985fb1fcfb3c9a0c22c1561f08e11de8d6714

@arkadiusz-swierczek-pm arkadiusz-swierczek-pm changed the title Default export in JS utilities function Export in JS utilities function Nov 4, 2024
@arkadiusz-swierczek-pm
Copy link
Author

arkadiusz-swierczek-pm commented Nov 24, 2024

@igorlukanin Do you have any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question The issue is a question. Please use Stack Overflow for questions.
Projects
None yet
Development

No branches or pull requests

2 participants