originjs / vite-plugins

Other
171 stars 30 forks source link

require context code regex match fail #13

Closed XinChou16 closed 2 years ago

XinChou16 commented 2 years ago

Versions

Reproduction

Additional Details
```js const components = getFilesByContext(require.context('../components/views', false, /\.vue$/)); ```

Steps to reproduce

  1. pass the require.context return to a function params
  2. the regex matched fail

What is Expected?

regex match right, no error

What is actually happening?

error with Unexpected token ')'

XinChou16 commented 2 years ago

This workes well


const matchedFiles = require.context('../components/views', false, /\.vue$/);
const components = getFilesByContext(matchedFiles);
PeterAlfredLee commented 2 years ago

Hi @XinChou16 Thank you for your reporting. Will fix this soon.

PeterAlfredLee commented 2 years ago

Hi @XinChou16 I have pushed a new version 1.0.8. Please have a try.

XinChou16 commented 2 years ago

Hi @XinChou16 I have pushed a new version 1.0.8. Please have a try.

The version v1.0.8 file seems as the same as v1.0.7

Here is the link https://cdn.jsdelivr.net/npm/@originjs/vite-plugin-require-context@1.0.8/lib/index.js

PeterAlfredLee commented 2 years ago

Oops. I forgot to made a build before publish.

PeterAlfredLee commented 2 years ago

Hi @XinChou16 Please have a look at 1.0.9.

XinChou16 commented 2 years ago

It works well with v1.0.9. Thanks a lot~