Open mxstbr opened 6 years ago
Yep I would say so. Add your .flowconfig
and:
// babel.config.js
module.exports = {
presets: ['graphpack/babel', '@babel/preset-flow'],
};
Can I somehow remove the built-in TypeScript support from graphpack/babel
? I don't want that to accidentally interfere with any of the flow typings.
Oh good point! Well, since there's not much in graphpack/babel
, you could just use what's in there and remove the TS preset:
// babel.config.js
module.exports = {
plugins: ['@babel/plugin-syntax-dynamic-import'],
presets: [
['@babel/preset-env', { targets: { node: 'current' }, modules: false }],
'@babel/preset-flow',
],
};
I see, makes sense! Maybe it's worth making that an option?
module.exports = {
presets: [
[['graphpack/babel', { types: 'flow' | 'typescript' | false }]],
};
Ideally, Graphpack can detect whether there's a .flowconfig
or tsconfig.json
and adds babel presets accordingly. This way we wouldn't have to deal with babel config at all.
I see that graphpack supports TypeScript out of the box (#12), how about Flowtype? Would that only require adding a custom Babel configuration?