webpack-conditional-loader
webpack-conditional-loader copied to clipboard
Fix on Windows
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.
I would suggest to use the regular expression /[\r\n]+/g to detect end of lines:
const sourceByLine = source.split(/[\r\n]+/g)