yandex / reselector

Use React Components in css selectors
https://npm.im/reselector
Other
45 stars 10 forks source link

Fails on function declaration components #6

Closed kachav closed 6 years ago

kachav commented 6 years ago

i have a component, exports like this: export default function Placement() {return some jsx}

build failed with:

ERROR in ./src/components/Products/Placement/Placement.jsx
Module build failed: Error: ***Placement.jsx: We don't know what to do with this node type. We were previously a Statement but we can't fit in here?
    at NodePath.insertAfter (***/node_modules/babel-traverse/lib/path/modification.js:175:13)
    at PluginPass.JSXElement (***/node_modules/reselector/babel.js:29:16)
    at newFn (***/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (***/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (***/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (***/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (***/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitSingle (***/node_modules/babel-traverse/lib/context.js:108:19)
    at TraversalContext.visit (***/node_modules/babel-traverse/lib/context.js:192:19)
    at Function.traverse.node (***/node_modules/babel-traverse/lib/index.js:114:17)
 @ ./src/components/Products/Placement/index.js 1:0-38
 @ ./src/components/Products/index.js
 @ ./src/routes.jsx
 @ ./src/client.jsx
 @ multi (webpack)-dev-server/client?https://localhost:8080 webpack/hot/dev-server client

it solves when i changed it to:

const Placement = () => some jsx

lttb commented 6 years ago

Fixed in 0.9.1