You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@weswigham Should this be closed since its a dupe?
From my point of view, this is a decent sized issue since it prevents tree shaking to work, thus creates larger than necessary bundles that need workarounds to prevent.
TypeScript Version: 2.7.0-dev.201xxxxx
Code
https://www.typescriptlang.org/play/index.html#src=class%20Sample%20%7B%0D%0A%20%20%20%20demo%20%3D%20()%20%3D%3E%20%7B%0D%0A%0D%0A%20%20%20%20%7D%0D%0A%7D%0D%0A%0D%0Aconst%20Button%20%3D%20%2F*%40__PURE__*%2F%20new%20Sample().demo
Expected behavior:
The comment should not be stripped
Actual behavior:
The comment is stripped and tree shaking breaks in production.
Related:
"Tree shaking" works when using
ES6
modules and targeting the file directly, e.gimport { Button } from "lib/Button"
But if you want, what I want, the glorious way of doing
import { Button } from "lib"
Then it's no good. UNLESS the transpiled code (the output before minifying) in the exported file looks like
const Button = /*@__PURE__*/ whateverFunctionThatCreatesButton { }
In other words, it's a no go with Typescripts compiler as it will remove that comment.
The text was updated successfully, but these errors were encountered: