layershifter / babel-plugin-transform-react-handled-props

Generates handledProps from defaultProps and propTypes during the build :sparkles:
MIT License
19 stars 4 forks source link

Unexpected token #46

Closed depoulo closed 4 years ago

depoulo commented 6 years ago
ModuleParseError: Module parse failed: Unexpected token (102:4)
You may need an appropriate loader to handle this file type.
|   };
| }
> 2657:3258.handledProps = [];

Has anyone encountered this issue? Setup: React 16.4, Webpack 4, Babel 7 (more details coming)

depoulo commented 6 years ago

.babelrc:

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "useBuiltIns": "usage"
      }
    ],
    "@babel/preset-react"
  ],
  "plugins": [
    "babel-plugin-dynamic-import-node",
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-object-rest-spread",
    "@babel/plugin-syntax-dynamic-import",
    "loadable-components/babel",
    "transform-react-handled-props"
  ],
  "env": {
    "production": {
      "plugins": [
        [
          "babel-plugin-lodash",
          {
            "id": ["lodash", "recompose"],
            "workaround": "https://github.com/facebook/jest/issues/3959",
            "reason": "https://github.com/istanbuljs/babel-plugin-istanbul/issues/116"
          }
        ],
        [
          "transform-react-remove-prop-types",
          {
            "mode": "remove",
            "removeImport": true,
            "ignoreFilenames": ["node_modules"],
            "additionalLibraries": ["react-immutable-proptypes"]
          }
        ]
      ]
    },
    "development": {
      "plugins": [["babel-plugin-lodash", { "id": ["lodash", "recompose"] }]]
    }
  }
}
depoulo commented 6 years ago

Been helping myself with the export hack, would have preferred this module here though...

layershifter commented 6 years ago

@depoulo can you please provide a minimal source code to repro this issue?

depoulo commented 6 years ago

I narrowed it down to default exported anonymous functional HOCs.