Angular 4 Production版本没有变化

时间:2018-09-12 13:24:13

标签: angular angular-cli

我正在使用角度4。当我对本地进行更改时,它的工作正常,但是当我使用ng build --prod构建我的应用程序时,它反映出生产网站dist上的更改与以前相同。角度cli版本是

   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.4.4
node: 8.11.4
os: win32 x64
@angular/animations: 4.4.4
@angular/common: 4.4.4
@angular/compiler: 4.4.4
@angular/core: 4.4.4
@angular/forms: 4.4.4
@angular/http: 4.4.4
@angular/platform-browser: 4.4.4
@angular/platform-browser-dynamic: 4.4.4
@angular/router: 4.4.4
@angular/cli: 1.4.4
@angular/compiler-cli: 4.4.4
@angular/language-service: 4.4.4
typescript: 2.3.4

2 个答案:

答案 0 :(得分:0)

在dist之类的文件中,例如bundles,其名称前是否有一个哈希?例如Vendor.bundles.eqwkeu23894u3d.js ??

IIf因此,它的工作原理是,还让您比较了不使用--prod然后使用--prod的捆绑包大小。 ng build --prod应该用于生产。

尝试ng build --env=prod --target=prod

https://github.com/angular/angular-cli/wiki/build

答案 1 :(得分:0)

您是说dist文件夹中的内容没有更新吗?可能性不大,但是请检查angular-cli.json并查看是否有以下行:"outDir": "dist"

相关问题