Skip to content

Cannot read properties of undefined (reading 'match') error when using comments without space before text #6

@Vorion86

Description

@Vorion86

Hi,
after upgrading to version 1.0.0 (and also the latest 1.0.2) I'm getting the following error using the vite plugin (unplugin-preprocessor-directives/vite)

Cannot read properties of undefined (reading 'match')

After some testing, I found that this error seems to occur if a javascript comment does not contain a space after "//".
This comment creates an error : "//error comment", while this works without any issue "// working comment".
I've also created a playground demonstrating the issue at stackblitz:
https://stackblitz.com/edit/vitejs-vite-hy77nf?file=package.json,src%2FApp.vue
(Comment is in App.vue)

Thanks.

Edit: After rechecking stackblitz with Firefox I get an erorr saying "comment is undefined", Chrome shows the error above.

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