gucong3000 / postcss-jsx

PostCSS syntax for parsing CSS in JS literals
MIT License
76 stars 28 forks source link

Cannot read property 'objectExpression' of undefined #8

Closed shinnn closed 6 years ago

shinnn commented 6 years ago
'use strict';

const postcss = require('postcss'); // v6.0.22
const postcssJsx = require('postcss-jsx'); // v0.10.0

(async () => {
  try {
    await postcss().process('x().y(z => {});', {
      syntax: postcssJsx,
      from: 'source.jsx'
    });
  } catch (err) {
    console.error(err);
  }
})();
$ node example.js
TypeError: Cannot read property 'objectExpression' of undefined
    at path.get.forEach (/Users/example/node_modules/postcss-jsx/extract.js:123:12)
    at Array.forEach (<anonymous>)
    at enter (/Users/example/node_modules/postcss-jsx/extract.js:114:28)
    at NodePath._call (/Users/example/node_modules/@babel/traverse/lib/path/context.js:65:20)
    at NodePath.call (/Users/example/node_modules/@babel/traverse/lib/path/context.js:36:14)
    at NodePath.visit (/Users/example/node_modules/@babel/traverse/lib/path/context.js:100:12)
    at TraversalContext.visitQueue (/Users/example/node_modules/@babel/traverse/lib/context.js:142:16)
    at TraversalContext.visitSingle (/Users/example/node_modules/@babel/traverse/lib/context.js:102:19)
    at TraversalContext.visit (/Users/example/node_modules/@babel/traverse/lib/context.js:182:19)
    at Function.traverse.node (/Users/example/node_modules/@babel/traverse/lib/index.js:106:17)