babel / minify

:scissors: An ES6+ aware minifier based on the Babel toolchain (beta)
https://babeljs.io/repl
MIT License
4.39k stars 225 forks source link

transform-remove-console: Flow declarations as bindings #874

Open fbartho opened 6 years ago

fbartho commented 6 years ago

Describe the bug

Using transform-remove console, I'm getting the following error when running the Metro Bundler for a react-native app:

transform[stderr]: 
transform[stderr]:         You or one of the Babel plugins you are using are using Flow declarations as bindings.
transform[stderr]:         Support for this will be removed in version 7. To find out the caller, grep for this
transform[stderr]:         message and change it to a `console.trace()`.
transform[stderr]:       
transform[stderr]: 
transform[stderr]:         You or one of the Babel plugins you are using are using Flow declarations as bindings.
transform[stderr]:         Support for this will be removed in version 7. To find out the caller, grep for this
transform[stderr]:         message and change it to a `console.trace()`.
transform[stderr]:       
transform[stderr]: 
transform[stderr]:         You or one of the Babel plugins you are using are using Flow declarations as bindings.
transform[stderr]:         Support for this will be removed in version 7. To find out the caller, grep for this
transform[stderr]:         message and change it to a `console.trace()`.
transform[stderr]:       
transform[stderr]: 
transform[stderr]:         You or one of the Babel plugins you are using are using Flow declarations as bindings.
transform[stderr]:         Support for this will be removed in version 7. To find out the caller, grep for this
transform[stderr]:         message and change it to a `console.trace()`.

To Reproduce

Make a react-native project, configure a .babelrc like:

{
    "comments": false,
    "ignore": ["node_modules/(?!react-navigation)"],
    "presets": ["react-native"],
    "plugins": [
        "transform-flow-strip-types",
        ["transform-remove-console", { "exclude": ["error"] }]
        ["react-intl", { "messagesDir": "./lang/messages/" }]
    ],
    "sourceMaps": "inline"
}

Actual Output

See the above snippet.

Expected Output

No errors leaked out in the logs

Configuration

TypeScript 2.9, React-Native Project

babel-plugin-transform-remove-console: 6.9.4

babel version : 7.0.0-beta.51

babel-minify-config: N/A

babelrc:

Included above

Possible solution

boopathi commented 6 years ago

This error is not thrown by babel-minify.

It's interesting that it occurs only when transform-remove-console is used??