How to remove Typescript assert when using npm run build?
Asked Answered
G

1

3

What is the best way to remove Typescript asserts so that a production build created using npm run build is assert free?

Thank you

Giselagiselbert answered 24/3, 2020 at 14:16 Comment(0)
P
1

The fastest solution I know is to use assert-plus on your project.

You can easily deactivate assertion according to your environment (production, development,..).

Phlebotomize answered 24/3, 2020 at 14:33 Comment(1)
In my opinion when you deactivate the assertion thanks to the environment variable, the function is not removed but just content of the function return void. There is still a problem, the evaluation of the condition is still present in the call of assert(condition). Did I miss something in the library ?Ashbey

© 2022 - 2024 — McMap. All rights reserved.