vite-plugin / vite-plugin-commonjs

A pure JavaScript implementation for CommonJs
MIT License
105 stars 16 forks source link

Internal server error: str.includes is not a function #22

Closed JinZhang-96 closed 1 year ago

JinZhang-96 commented 1 year ago

For example, if commonjs dynamically imports files such as require ('../a/b'+value+'. png'), the above error will be reported。

code position: 424 line at index.js

const example = "For example: import(./foo/${bar}.js)."; function sanitizeString(str) { if(typeof str !== undefined){ str = str+"" } if (str.includes("")) { throw new Error("A dynamic import cannot contain characters."); } return str; }

caoxiemeihao commented 1 year ago

Can you provide a minimal reproduction repo?