Huge number of files generated for every Angular project

后端 未结 14 1077
旧时难觅i
旧时难觅i 2020-11-28 00:37

I wanted to start a simple hello world app for Angular.

When I followed the instructions in the official quickstart the installation created 32,000 files in my proje

14条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 01:09

    You need to ensure that you're just deploying the dist (short for distributable) folder from your project generated by the Angular CLI. This allows the tool to take your source code and it's dependencies and only give you what you need in order to run your application.

    That being said there is/was an issue with the Angular CLI in regards to production builds via `ng build --prod

    Yesterday (August 2, 2016) a release was done which switched the build mechanism from broccoli + systemjs to webpack which successfully handles production builds.

    Based upon these steps:

    ng new test-project
    ng build --prod
    

    I am seeing a dist folder size of 1.1 MB across the 14 files listed here:

    ./app/index.js
    ./app/size-check.component.css
    ./app/size-check.component.html
    ./favicon.ico
    ./index.html
    ./main.js
    ./system-config.js
    ./tsconfig.json
    ./vendor/es6-shim/es6-shim.js
    ./vendor/reflect-metadata/Reflect.js
    ./vendor/systemjs/dist/system.src.js
    ./vendor/zone.js/dist/zone.js
    

    Note Currently to install the webpack version of the angular cli, you must run... npm install angular-cli@webpack -g

提交回复
热议问题