UNPKG

spinjs

Version:

<p align="center"><a href="#"><img width="150" src="https://rawgit.com/sysgears/spinjs/master/logo.svg"></a></p>

29 lines (26 loc) 795 B
import { Builder } from '../Builder'; import { ConfigPlugin } from '../ConfigPlugin'; import Spin from '../Spin'; import JSRuleFinder from './shared/JSRuleFinder'; export default class FlowRuntimePLugin implements ConfigPlugin { public configure(builder: Builder, spin: Spin) { const stack = builder.stack; if (stack.hasAll(['flow-runtime', 'webpack']) && !stack.hasAny('dll')) { const jsRuleFinder = new JSRuleFinder(builder); const jsRule = jsRuleFinder.findAndCreateJSRule(); jsRule.use = spin.merge(jsRule.use, { options: { plugins: [ [ 'babel-plugin-flow-runtime', { assert: true, annotate: true } ] ] } }); } } }