dearrrfish/preprocess-loader

Constant declaration

Opened this issue · 2 comments

How can I fix this error ?

// @if TARGET='web'
  const finalSource = useStream(stream);
  // @endif

  // @if TARGET='app'
  const finalSource = useFileStream(file);
  // @endif
 error  Parsing error: Identifier 'finalSource' has already been declared

One possible way would be to do something like this:

let finalSource;

// @if TARGET='web'
finalSource = useStream(stream);
// @endif

// @if TARGET='app'
finalSource = useFileStream(file);
// @endif

Thanks, that's what I did 👍