Skip to content

@11ty/dependency-tree-typescript error when file has JSX/TSX #7

@teddybradford

Description

@teddybradford

I think there's a bug. @sveltejs/acorn-typescript claims to have "Support to parse JSX & TSX"
but if a file has JSX/TSX in it, I get this error:

SyntaxError: Unterminated regular expression (4:21) (The error occurs at the forward slash in </div> in foo.tsx, seen below.)

Below is some example code. If I replace return <div>{bar}</div>; in foo.tsx with return bar; the find() function appears to work properly.

find-deps.ts

import { find } from '@11ty/dependency-tree-typescript';

console.log(await find('foo.tsx'));

foo.tsx

import { bar } from './bar';

export default function () {
  return <div>{bar}</div>;
}

bar.ts

export const bar = 'bar';

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