Skip to content

After upgrading to 5.0, importFromFigma reported an error. #88

@Aluomolo

Description

@Aluomolo

I configured the import script according to official website's document. It has been used normally before。However, the execution will fail after the upgrade, and the error message does not provide the error reason.

My figma folder looks like:

Image

My import script:

  let res;
  try {
    res = await importFromFigma({
      prefix: 'ast',
      file: '',
      token: '',
      cacheDir,
      depth: 3,
      filterParentNode: (nodes) => {
        switch (nodes.length) {
          case 1: {
            const node = nodes[0];
            return node?.name === 'icon';
          }
          case 2: {
            const node = nodes[1];
            return ['planet', 'c_planet', 'c_zodiac', 'zodiac', 'elements', 'basic', 'title'].includes(node?.name || 'NULL');
          }
        }
        return false;
      },

      iconNameForNode: (node) => {
        if (
          node.parents.length !== 2 ||
          (node.type !== 'FRAME' && node.type !== 'COMPONENT' && node.type !== 'INSTANCE')
        ) {
          return null;
        }

        return node.name;
      }
    });
  } catch (err) {
    console.log('import from figma error: ', err);
  }

the err:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions