onebay / vite-plugin-imp

A vite plugin for import library component style automatic.
MIT License
231 stars 24 forks source link

is the ignoreStylePathNotFound logic reversed? #37

Closed nanxiaobei closed 1 year ago

nanxiaobei commented 2 years ago

https://github.com/onebay/vite-plugin-imp/blob/main/src/shared.ts#L100

Why when "ignore", then check if path exist?

psaren commented 2 years ago

ignoreStylePathNotFound = true (default is true in vite serve) vite-plugin-imp will get a warn message when the style path is not found, and return '', this will avoid error accur. developer should according to warn message, adjust the style method to return the right style path.

ignoreStylePathNotFound = false when the style path is not found, it will not check whether style is exist and return import ${stylePath}, and you will get error like *** MODULE_NOT_FOUND.

nanxiaobei commented 2 years ago

understood, thanks! cause the "ignore" meaning leads to misunderstanding. if it's warnStylePathNotFound would be clear!

nanxiaobei commented 2 years ago

currently is that in yarn workspaces: require(stylePath) can not find the file, will warn "xxx is not found!" import stylePath is fine.

psaren commented 2 years ago

pelease provide a minimal repo or an online link(codesandbox/stackblitz) to reproduce the issue.