Skip to content

Parse error (unexpected token) on dynamic import #1149

Closed
@alexgurr

Description

@alexgurr

If you're reporting a bug, please include input code, output documentation,
a description of what you expected to happen, and what happened instead.

  • What version of documentation.js are you using?: 9.0.0 ALPHA 0
  • How are you running documentation.js (on the CLI, Node.js API, Grunt, other?): CLI
export default class Icon extends React.Component<IconProps, IconState> {
  static defaultProps: Object;

  constructor(props: IconProps) {
   ...
   import(`../../../assets/icons/${props.name}.svg`)
      .then(url => this.setState({ icon: url }))
      .catch(() => {});
  }

When I comment this 'import' statement out, documentation.js runs fine. When I leave it in I get: "Icon.js: Unexpected token (52:10)".

I saw this was fixed in a PR last year but seems to be a problem for me?

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