Skip to content

[vite-plugin-require-context] Import fails when the regular expression contains , #44

Description

@am-ma

Versions

  • originjs: v1.0.9
  • node: v18.12.1

Steps to reproduce

  • setup vite-plugin-require-context
  • use require.context with the regular expression contains ,
    • ex. require.context(/[a-Z,]+.js/)

What is Expected?

  • Import must not fail

What is actually happening?

  • Import fails
    • because the following code causes the regular expression to be split in the middle.
    • const params = paramsSyntax.split(','); (lib/index.js: 54)
SyntaxError: Invalid regular expression: missing /
❯ node_modules/@originjs/vite-plugin-require-context/lib/index.js:57:40
❯ TransformContext.transform node_modules/@originjs/vite-plugin-require-context/lib/index.js:52:35

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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