#5718·babel

flowtype "declare var module" causes transform-flow-strip-types to transpile module to _module

Author: philiiiiiippCreated May 8, 2017Updated Sep 2, 2026
Labelshelp wantedarea: flow

Choose one: is this a bug report or feature request? bug report

When using flowtype's

javascript
declare var module

in a file which uses module.exports, transform-flow-strip-types produces

javascript
_module.exports

instead of

javascript
module.exports

Here is the sample code to reproduce https://github.com/philiiiiiipp/modules_test

Babel Configuration (.babelrc, package.json, cli command)

javascript
"babel": {
    "presets": [
      "es2015",
      "stage-2"
    ],
    "plugins": [
      "transform-flow-strip-types"
    ]
  }
software version(s)
Babel 6.24.1
node v6.10.3
npm 4.2.0
Operating System OSX 10.11.6