Detalhes do pacote

@tybys/ts-transform-pure-class

toyobayashi79MIT0.1.1

Replace /** @class */ to /*#__PURE__*/ in ES5 class output for better tree shaking.

readme (leia-me)

ts-transform-pure-class

Replace /** @class */ to /*#__PURE__*/ in ES5 class output for better tree shaking.

Input:

class C {}

Output:

var C = /*#__PURE__*/ (function () {
    function C() {
    }
    return C;
}());

Usage

npm install -D @tybys/ts-transform-pure-class
<summary>ttypescript</summary>
json { "compilerOptions": { "removeComments": false, "target": "ES5", "plugins": [ { "transform": "@tybys/ts-transform-pure-class", "type": "raw", "after": true } ] } }
<summary>webpack</summary>
json { "compilerOptions": { "removeComments": false, "target": "ES5" } } js // webpack.config.js module.exports = { module: { rules: [ { test: /\.tsx?$/, use: [ { loader: 'ts-loader', options: { getCustomTransformers () { return { after: [require('@tybys/ts-transform-pure-class').default] } } } } ] } ] } }
<summary>rollup</summary>
json { "compilerOptions": { "removeComments": false, "target": "ES5", "module": "ESNext" } } js // rollup.config.js import { join } from 'path' import typescript from '@rollup/plugin-typescript' export default { plugins: [ typescript({ transformers: { after: [require('@tybys/ts-transform-pure-class').default] } }) ] }