1

I'm trying to reduce the size of my angular 2 application by applying tree shaking technique.

I'm using webpack 2.1.0-beta.22, angular 2 rc6 and typescript 2.0.2.

Here is my tsconfig.json:

"compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "removeComments": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
},
"exclude": [
    "node_modules"
]

webpack.config:

module: {
    loaders: [
         {
            test: /\.ts$/,
            loaders: ['ts', 'angular2-template-loader']
        }
    ]
},
plugins: {
    new webpack.LoaderOptionsPlugin({
        minimize: true,
        debug: false
    }),
    new webpack.optimize.UglifyJsPlugin({
        beautify: false,
        compress: { screw_ie8: true },
        comments: false,
        screw_ie8: true,
        sourceMap: true
    })
}

Bundle size before tree shaking was ~ 1.7MB, and after tree shaking size became ~ 1.8MB.

What do I do wrong?

4

0 に答える 0