rollup-plugin-flow-no-whitespace
raw JSON → 1.0.0 verified Mon Apr 27 auth: no javascript
A Rollup plugin that removes Flow type annotations from JavaScript files without leaving extra whitespace. Current stable version 1.0.0. Useful for developers using Flow type checking who want to produce clean output after stripping types, avoiding double spaces or blank lines that other plugins may leave. Minimal and focused utility, likely with low release cadence.
Common errors
error Error: Cannot find module 'flow-remove-types' ↓
cause Missing required dependency flow-remove-types
fix
npm install flow-remove-types
error rollup-plugin-flow-no-whitespace is not a plugin ↓
cause Forgetting to call the exported function
fix
Use flowNoWhitespace() instead of just flowNoWhitespace
error Unexpected token (X:Y) in file with Flow type annotations ↓
cause Flow types not removed before other JS transformations
fix
Ensure flowNoWhitespace() plugin is included in the plugins array before other plugins that parse JavaScript
Warnings
gotcha Must use as a function call, not a reference ↓
fix Use flowNoWhitespace() with parentheses in the plugins array.
gotcha Only removes Flow type annotations, does not handle other transformations ↓
fix Consider using other plugins for additional transformation needs.
deprecated Flow is not as widely used as TypeScript, may not receive updates ↓
fix Consider migrating to TypeScript or using a more maintained plugin.
gotcha May not work with Rollup v3 or v4 without adjustments ↓
fix Check compatibility; plugin was likely built for Rollup v2.
breaking Whitespace removal behavior might differ from other type-stripping plugins ↓
fix Test output thoroughly to ensure whitespace is as expected.
Install
npm install rollup-plugin-flow-no-whitespace yarn add rollup-plugin-flow-no-whitespace pnpm add rollup-plugin-flow-no-whitespace Imports
- default wrong
const flowNoWhitespace = require('rollup-plugin-flow-no-whitespace')correctimport flowNoWhitespace from 'rollup-plugin-flow-no-whitespace' - flowNoWhitespace wrong
import { flowNoWhitespace } from 'rollup-plugin-flow-no-whitespace'correctimport flowNoWhitespace from 'rollup-plugin-flow-no-whitespace' - plugin usage wrong
export default { plugins: [flowNoWhitespace] }correctexport default { plugins: [flowNoWhitespace()] }
Quickstart
import flowNoWhitespace from 'rollup-plugin-flow-no-whitespace';
export default {
input: 'src/index.js',
output: { file: 'dist/bundle.js', format: 'cjs' },
plugins: [flowNoWhitespace()]
};