gajus / gajus/flow-runtime

Use `require` instead of `import`

Open
#207 5 comments 0 reactions 0 assignees View on GitHub
:dollar: Funded on Issuehunt
Dominant language
JavaScript
Stars
797
Forks
49
PR merge metrics
No merged PRs in 30d

Description

[Issuehunt badges](https://oss.issuehunt.io/r/gajus/flow-runtime/issues/207)

I just started to use flow-runtime & babel-plugin-flow-runtime, because these are very powerful packages.

This is a:

- [ ] Bug Report
- [x] Feature Request
- [ ] Question
- [ ] Other

Which concerns:

- [ ] flow-runtime
- [X] babel-plugin-flow-runtime
- [ ] flow-runtime-validators
- [ ] flow-runtime-mobx
- [ ] flow-config-parser
- [ ] The documentation website

---

### What is the current behaviour?

Currently babel-plugin-flow-runtime generates code like this:

```
import t from 'flow-runtime';
const User = t.type('User', t.object(
t.property('id', t.number()),
t.property('name', t.string())
));
```

---

### What is the expected behaviour?

My proposal is generating code like this:

```
const t = require('flow-runtime');
const User = t.type('User', t.object(
t.property('id', t.number()),
t.property('name', t.string())
));
```

If I can use flow-runtime & babel-plugin-flow-runtime without adding another plugin to transpile `import`, it becomes non-intrusive.

---

### Which package versions are you using?

---

IssueHunt Summary

### Backers (Total: $40.00)

- [issuehunt issuehunt](https://oss.issuehunt.io/u/issuehunt) ($40.00)

### Submitted pull Requests
- [#287 Add require runtime import option](https://oss.issuehunt.io/r/gajus/flow-runtime/pull/287)
- [#294 feat(plugin): add require runtime import option (issue #207)](https://oss.issuehunt.io/r/gajus/flow-runtime/pull/294)
---

#### [Become a backer now!](https://oss.issuehunt.io/r/gajus/flow-runtime/issues/207)
#### [Or submit a pull request to get the deposits!](https://oss.issuehunt.io/r/gajus/flow-runtime/issues/207)
### Tips

- Checkout the [Issuehunt explorer](https://oss.issuehunt.io/r/gajus/flow-runtime/) to discover more funded issues.
- Need some help from other developers? [Add your repositories](https://oss.issuehunt.io/r/new) on IssueHunt to raise funds.

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named. Start by locating the babel-plugin-flow-runtime entry point that generates the flow-runtime import, then check existing tests for generated output. Done means the plugin can produce the proposed require-based runtime initialization without requiring a separate import-transpilation plugin; note that pull requests #287 and #294 already address this issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.