Preact-cli: Flow support

Created on 22 May 2017  路  8Comments  路  Source: preactjs/preact-cli

Hello,
This monday morning, I'm toying with preact-cli : super enjoyable experience !
I was just wondering what's your stance on Flow type system support ?
Thanks :)

enhancement help wanted

Most helpful comment

Guys, let's keep it at #15 馃槢

All 8 comments

Or, is there any config override to provide babel with the right plugins ?

There isn't yet, but it's something we need to add. I've proposed an optional file preact.config.js:

module.exports = config => {
  // config is the webpack configuration.
  // you can mutate it here before webpack runs.

  let babel = config.loaders.find( ({ loader }) => loader.match(/babel-loader/) );
  // add your plugins:
  babel.options.plugins.push( 'transform-strip-flow-types' );
};

Alternatively, it might be fine to add a --babel-plugins CLI argument that handles this likely common case. Or, better yet, we can have preact-cli look for a .babelrc file in your repo root and use that if it exists 馃帀

Awesome !
As extending Webpack config is a superset of extending babel config, I would favor your preact.config.js proposal, but using ${PROJECT}/.babelrc could be smooth enough in most cases 馃憤

Next.js allow to have a custom config file like this. But manipulation the webpack config without any helpers is actually a pain, especially the loaders section.

Guys, let's keep it at #15 馃槢

There is a flow plugin which we can use for using flow in preact-cli.

Thanks to @SaraVieira 馃槃

@reznord Hells yeah 馃帀

There is a flow plugin which we can use for using flow in preact-cli.

Thanks to @SaraVieira 馃槃

Hi guys,
FYI this approach is not working out of box.
For more details see https://github.com/SaraVieira/preact-cli-plugin-flow/issues/7

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ajay28kumar picture ajay28kumar  路  3Comments

AlStar01 picture AlStar01  路  3Comments

ethanwu10 picture ethanwu10  路  3Comments

jpoo90 picture jpoo90  路  4Comments

hardcoar picture hardcoar  路  3Comments