LeetCode-OpenSource/emotion-ts-plugin

TypeError: Cannot read property 'text' of undefined

RoyalHunt opened this issue · 0 comments

Hi there! Tried to use the plugin for labels in TS, but I've got an error above on the next line: https://github.com/LeetCode-OpenSource/emotion-ts-plugin/blob/master/src/index.ts#L200

Webpack config:

        {
          test: /\.tsx?$/,
          exclude: /node_modules/,
          loader: require.resolve('ts-loader'),
          options: {
            getCustomTransformers: () => ({
              before: [
                createEmotionPlugin({
                  sourcemap: true,
                  autoLabel: true,
                  labelFormat: '[filename]--[local]',
                  autoInject: false,
                }),
              ],
            }),
          },
        },

expression example in my case is:

IdentifierObject {
  pos: 544,
  end: 551,
  flags: 0,
  modifierFlagsCache: 0,
  transformFlags: 536870912,
  parent:
   NodeObject {
     pos: 544,
     end: 561,
     flags: 0,
     modifierFlagsCache: 0,
     transformFlags: 536870912,
     parent:
      NodeObject {
        pos: 544,
        end: 618,
        flags: 0,
        modifierFlagsCache: 0,
        transformFlags: 536871041,
        parent: [NodeObject],
        kind: 197,
        tag: [Circular],
        questionDotToken: undefined,
        typeArguments: [Array],
        template: [TokenObject],
        id: 23219 },
     kind: 195,
     expression: [Circular],
     questionDotToken: undefined,
     arguments:
      [ [IdentifierObject],
        pos: 552,
        end: 560,
        transformFlags: 536870912 ],
     id: 23220 },
  kind: 75,
  escapedText: 'styled',
  flowNode:
   { flags: 16,
     antecedent: { flags: 1026 },
     node:
      NodeObject {
        pos: 107,
        end: 527,
        flags: 0,
        modifierFlagsCache: 536870912,
        transformFlags: 536936595,
        parent: [NodeObject],
        kind: 241,
        name: [IdentifierObject],
        type: undefined,
        initializer: [NodeObject],
        symbol: [SymbolObject] } },
  id: 23221 }

and subExpression:

IdentifierObject {
  pos: 599,
  end: 606,
  flags: 0,
  modifierFlagsCache: 0,
  transformFlags: 536870912,
  parent:
   NodeObject {
     pos: 599,
     end: 621,
     flags: 0,
     modifierFlagsCache: 0,
     transformFlags: 536870912,
     parent:
      NodeObject {
        pos: 599,
        end: 856,
        flags: 0,
        modifierFlagsCache: 0,
        transformFlags: 536871041,
        parent: [NodeObject],
        kind: 197,
        tag: [Circular],
        questionDotToken: undefined,
        typeArguments: undefined,
        template: [NodeObject],
        id: 23912 },
     kind: 195,
     expression: [Circular],
     questionDotToken: undefined,
     arguments:
      [ [IdentifierObject],
        pos: 607,
        end: 620,
        transformFlags: 536870912 ],
     id: 23913 },
  kind: 75,
  escapedText: 'styled',
  flowNode:
   { flags: 16,
     antecedent: { flags: 1026 },
     node:
      NodeObject {
        pos: 125,
        end: 582,
        flags: 0,
        modifierFlagsCache: 536870912,
        transformFlags: 536936595,
        parent: [NodeObject],
        kind: 241,
        name: [IdentifierObject],
        type: undefined,
        initializer: [NodeObject],
        symbol: [SymbolObject] } },
  id: 23914 }

Do you have any idea?