Typescript - Removing some lines of code from production

Viewed 717

I'm trying to remove some code that should only appear in development mode, from production.
I've done this many times before using Webpack, as explained here

Remove some code lines in production distribution files?

This is my first time trying to do the same with typescript - Can the same be achieved?
I'm using Typescript as my compiler (no webpack or rollup), and I'm creating an ESM bundle with it.

Do I need another tool to strip dead code?

For reference this is what I'm trying to remove from my production build

if (process.env.NODE_ENV !== 'production') {
   console.log('Just a test');
}
0 Answers
Related