Replace given constants with boolean literals.
import { replaceWithBooleanLiteral } from '@tsm-cookbook/replace-with-boolean-literal'
export default defineConfig({
plugins: [replaceWithBooleanLiteral({
constants: {
globalObject: {
trueValue: true,
falsyValue: false,
}
}
})],
})
if (globalObject.trueValue) {
console.log('true')
}
if (globalObject.falsyValue) {
console.log('false')
}
To
if (true) {
console.log('true')
}
if (false) {
console.log('false')
}