svelte-native icon indicating copy to clipboard operation
svelte-native copied to clipboard

refactor logs for easy removal

Open farfromrefug opened this issue 5 years ago • 2 comments

https://github.com/halfnelson/svelte-native/blob/0af94fac6ea18f54f93ab299d0b512f91d722569/src/dom/svelte/SvelteNativeDocument.ts#L17

I now we already that discussion and you wanted to write it your way. But now i am asking for another reason. In production you can / should remove all console logs to make your app thinner and faster. In N (and i am starting to do that all over) we can apply a rule un production to easily remove logs. The idea is to look for

if (Trace.isEnabled()) {
...
}

and replace Trace.isEnabled() by false so that terser can remove the whole if code. In the case of svelte native it wont remove the log line because of the way you write your logs. I know this is not the way you wanted it but i am asking if you would agree to move to a more "common N" way so that the minify rule for logs could also be applied to 'svelte-native` code.

farfromrefug avatar Nov 26 '20 20:11 farfromrefug

svelte-native isn't very large and doesn't contain main log lines so I am not sure it is worth the effort and lower DX

halfnelson avatar Dec 15 '20 12:12 halfnelson

@halfnelson in a sense i agree with you. On the other hand every little step added makes a big step at the end. Getting the smallest possible vendor.js is i think a global goal in the N community. I am willing to create a PR if you are interested. The only really difference will be core readability

farfromrefug avatar Dec 15 '20 13:12 farfromrefug