Closed doberkofler closed 3 years ago
When preprocessing the following code without the DEBUG environment variable set:
'use strict'; var pp = require('preprocess'); var text = '//start\n// @ifdef DEBUG\nvar some;\n// @endif DEBUG\n//end'; console.log(pp.preprocess(text, {}, {type: 'js'}));
you would imagine, that the //start and //endlines will be returned but instead the following text will be returned:
//start
//end
//start DEBUG //end
Unfortunately preprocess will output whatever text is behind the @endif token and this seems very wrong to me.
@endif
I break out \nvar some;\n// to a separate variable, and wrap it in @ifdef to deal with that. Agree that it's surprising behavior.
\nvar some;\n//
@ifdef
When preprocessing the following code without the DEBUG environment variable set:
you would imagine, that the
//start
and//end
lines will be returned but instead the following text will be returned:Unfortunately preprocess will output whatever text is behind the
@endif
token and this seems very wrong to me.