caiogondim / webpack-conditional-loader

C conditionals directive for JavaScript
https://npm.im/webpack-conditional-loader
MIT License
110 stars 25 forks source link

bug at splitting file content to lines #19

Open moyuanz opened 4 years ago

moyuanz commented 4 years ago

const sourceByLine = source.split(os.EOL)

There's bug in above code that os.EOL need to be replaced by '\n'. In case in Windows system, but line is broken only with '\n', os.EOL in Windows is '\r\n'.

const endBlock = /\/\/ #endif$/

This above still have bug that change it like this const endBlock = /\/\/ #endif/