cube-js / cube-js/cube

Schema files as ES modules

Open
#307 10 comments 8 reactions 0 assignees View on GitHub
backend:server
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 5h
Merged PRs (30d)
193

Description

**Is your feature request related to a problem? Please describe.**
Currently schema files seem to have slightly different rules for globals and package names (e.g. `cube()` and `import Funnel from 'Funnel'`).

**Describe the solution you'd like**
It would be awesome if I could import modules using Node's existing rules, so a schema might look like this instead:

```javascript
import { cube, Funnels } from '@cubejs-backend/schema-compiler';

cube({
extends: Funnels.eventFunnel
...
});
```

Hopefully by using the ES6 module-loading mechanism, CubeJS might get to do less work with respect to setting up/parsing of schemas.

**Describe alternatives you've considered**
Not sure there are any, other than to stick with what exists.

**Additional context**
This might also make it easier for TypeScript support in schema files, since there would be no need to parse imports.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.