Do you want to work on this issue?
You can request for a bounty in order to promote it!
1 active bounty request
Use `require` instead of `import` #207
tnayuki posted onGitHub
I just started to use flow-runtime & babel-plugin-flow-runtime, because these are very powerful packages.
<!-- Thanks for using flow-runtime! To help us address your issue quickly please provide as much information about the problem you're facing, or the feature you'd like adding. -->
This is a:
- Bug Report
- Feature Request
- Question
- Other
Which concerns:
- flow-runtime
- babel-plugin-flow-runtime
- flow-runtime-validators
- flow-runtime-mobx
- flow-config-parser
- The documentation website
What is the current behaviour?
<!-- If this is a bug report or question, please include example code wherever possible. If your code is private and you can't share it, please create a sanitized version which reproduces the issue. You may find the online demo useful for this: https://codemix.github.io/flow-runtime/#/try NOTE: It is extremely difficult to fix bugs without examples! -->
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?
<!-- Please describe what you'd expect to happen under these circumstances. If you are describing a bug in the babel plugin, please indicate the output you'd expect it to produce. -->
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?
<!-- If this is a bug, which version(s) of the affected package(s) are you using? If you're describing a bug specific to an environment, like a certain browser or node version, please include that information here too. -->