babel-plugin-flow-react-proptypes
babel-plugin-flow-react-proptypes copied to clipboard
named exports not functioning with `modules: false` in webpack
When using babel + webpack with modules: false
exports
is not defined. This is because webpack generates a module wrapper with a signature of (function(module, __webpack_exports__, __webpack_require__) {
. conditionalExportsAst check is always false and named exports don't function as expected.
Configuring modules back to commonjs resolves the issue but it seems as though this should be supported.
Thanks for the report. What would the expected behavior be here? What code should we generate?
Ideally all imports/exports would be done using ES2015 modules, and these would be handled by webpack or transformed by babel further down the pipeline. I am not familiar with babel and don't know if it will traverse generated code.
Alternatively, provide an option between CJS or ES2015 so that the correct code will be emitted.