webpack-conditional-loader icon indicating copy to clipboard operation
webpack-conditional-loader copied to clipboard

Fix on Windows

Open Mirantus opened this issue 7 years ago • 1 comments

It's doesnt work on Windows when files have file encodings with '\n'. os.EOL returns '\n\r' so we have array sourceByLine as one string instead of multivalues. Then commentCodeInsideBlocks can't find this big string in truthyBlocks and nothing do.

Mirantus avatar Dec 19 '17 06:12 Mirantus

I would suggest to use the regular expression /[\r\n]+/g to detect end of lines:

const sourceByLine = source.split(/[\r\n]+/g)

bbert avatar Oct 09 '18 09:10 bbert