afterwind-io / preprocessor-loader

Bring the awesome "Conditional Compilation" to the Webpack, and more.
MIT License
40 stars 12 forks source link

No errors when missing closing endifs #39

Open tech-meppem opened 1 year ago

tech-meppem commented 1 year ago

I guess this is more of a feature request than a bug per se, but when you have an #!if that usually requires an #!endif, but it's missing, no error is produced.

Is it possible to add an option, that if at the end of the file it is expecting an #!endif, and there isn't one, it can throw / log an error?

For example, say this is a file:

function MyFunc() {
  let x = "foo";
  #!if debug
  x  = "bar"
}

Because there is no closing #!endif, it means the rest of the file will be removed on non-debug builds. Can an option be added where this will still have the same behaviour as now, but also logs this out as an error / warning if this missing #!endif is detected?