相关疑难解决方法(0)

如何在Webpack中使用树摇动?

我刚刚使用Angular 2(版本rc.2)app(带有Typescript)更新到webpack 2.1.0-beta.15,但我想知道如何使用树摇动功能.我读到它应该"开箱即用",但我仍然有一个1.7Mb的捆绑一个非常简单的应用程序,所以可能我做错了.

这是我到目前为止:

tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts"
  ]
}
Run Code Online (Sandbox Code Playgroud)

的package.json

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "build": "webpack --progress",
    "build:prod": "webpack -p --progress --optimize-minimize",
    "postinstall": "typings install",
    "serve": "webpack-dev-server --inline --progress --output-public-path=/dist/"
  },
  "license": "ISC",
  "dependencies": {
    "@angular/common": "2.0.0-rc.2",
    "@angular/compiler": "2.0.0-rc.2",
    "@angular/core": "2.0.0-rc.2",
    "@angular/forms": "0.1.0",
    "@angular/http": "2.0.0-rc.2",
    "@angular/platform-browser": "2.0.0-rc.2",
    "@angular/platform-browser-dynamic": "2.0.0-rc.2",
    "@angular/router": "2.0.0-rc.2",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.2",
    "angular-pipes": "1.4.0",
    "bootstrap": …
Run Code Online (Sandbox Code Playgroud)

bundle webpack angular

25
推荐指数
1
解决办法
6124
查看次数

标签 统计

angular ×1

bundle ×1

webpack ×1