rollup-plugin-flow-entry

raw JSON →
0.3.6 verified Mon Apr 27 auth: no javascript

Rollup plugin that generates .js.flow files from original source for Flow type checking. Current stable version 0.3.6. Released June 2020, last updated ~2020. Creates a re-export file alongside bundled output so Flow can find un-bundled types. Key differentiator: works with Rollup code splitting and @rollup/plugin-multi-entry, supports custom source mappings for TypeScript projects.

error Error: Could not resolve entry module
cause Missing or incorrect input file path relative to rollup config.
fix
Ensure input path matches actual file location, e.g., 'src/index.js'.
gotcha The .js.flow file is generated but not automatically removed on rollup -c rebuild if the plugin is removed.
fix Manually delete generated .js.flow files when changing plugin configuration.
gotcha Using mode option incorrectly (e.g., 'strict' instead of 'strict-local') causes no generation of .js.flow file.
fix Use valid mode values: undefined, 'local', 'strict-local', or 'all'.
deprecated Integration with @rollup/plugin-multi-entry may not be maintained; behavior may change.
fix Test plugin with your version of @rollup/plugin-multi-entry and consider alternatives.
npm install rollup-plugin-flow-entry
yarn add rollup-plugin-flow-entry
pnpm add rollup-plugin-flow-entry

Configure Rollup to generate a .js.flow file alongside the bundle, pointing to original Flow source.

// rollup.config.js
import flowEntry from 'rollup-plugin-flow-entry';

export default {
  input: 'src/index.js',
  output: {
    file: 'lib/index.js',
    format: 'cjs'
  },
  plugins: [
    flowEntry()
  ]
};