wrap the import?
I'm wondering if it would aslo make sens to let the plugin wrap the import/require of the warning dependency with a process.env.NODE_ENV !== 'production' block.
That shouldn't make any different when using a flat bundler like rollup but I think that would save us some module tree traversal when using a bundler like webpack.
Could work. Right now this is a literal copy/paste of https://github.com/facebook/fbjs/blob/master/packages/babel-preset-fbjs/plugins/dev-expression.js. That would take it away a bit.
It wouldn't necessarily be 100% maybe? e.g. I use it for https://github.com/reactjs/react-router/blob/8707d05b00273590e4d054771b8ae7ae9ad312e3/modules/RoutingContext.js#L3. But maybe that doesn't matter.
There's one catch to this proposal: wrapping an import is not valid ES6 and will cause babel to complain as such:
'import' and 'export' may only appear at the top level
However, I don't see harm in making it an option.