Sourcemaps are broken
Thank you for this interesting idea and plugin implementation!
I'm trying to migrate from webpack + linaria to vite + css modules and found this plugin very close to make the migration process almost as a drop-in replacement. Here are some of the tweaks made: https://github.com/Dmitra/vite-plugin-inline-css-modules.
The only thing I cannot make to work are sourcemaps. They are wrong and it looks like for exact amount of removed lines from the original file. Is it because they are not taken care of here: https://github.com/bluskript/vite-plugin-inline-css-modules/blob/master/src/index.ts#L70 ? Do you have any ideas how to fix it?
Hey,
Could you clarify what exactly is wrong with sourcemaps? They appear to work as expected for me when im testing it with the react demo:

I haven't tried it with your fork, but is this issue present in this repo?
yes, here is a master branch with Root.tsx changed to showcase the problem: line numbers are offset by exactly a single line, which was removed from original file by the plugin.
Line 7 was already executed and hello is defined, while world is not defined but should be.
I found sourcemap visualization tool, https://evanw.github.io/source-map-visualization/ which shows exactly that mapping is wrong:

Can you reproduce this issue? Unfortunately it makes debugging impossible.