danbucholtz / purge-unused-components

Sample app that doesn't include any Ionic components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

To get started

  1. npm install
  2. Pull down https://github.com/driftyco/ionic
  3. git checkout dead-code-removal
  4. Run gulp release.prepareReleasePackage to build custom version of ionic
  5. Open dist/ionic-angular/components and remove the unused component directories so ngc is happy when in user land i. Purge all components except app, avatar, backdrop, badge and then the ion base class files and metadata
  6. Copy dist/ionic-angular from ionic repo to this project's node_modules dir and overwrite ionic-angular.
  7. Run npm run ionic:build --prod --parseDeepLinks false to generate a prod build.
  8. Run source-map-explorer www/build/main.js www/build/main.js.map and see what's in the bundle

Debugging

  1. Run npm run ionic:build --aot --optimizejs --parseDeepLinks false. Look in .tmp directory for answers on why some code was retained

Weird things

  1. Why is badge in the bundle but not avatar or backdrop?

Running uglify on a specific file to test

  1. Open .tmp and find the file you're interested in inspecting
  2. Copy and paste the content into ./uglify-content.js. Remove any ES2015 stuff like import/export.
  3. Run node uglify.js and observe the output that is retained.
  4. Question yourself: Why is this different than what's in the bundle??

About

Sample app that doesn't include any Ionic components


Languages

Language:CSS 40.9%Language:TypeScript 23.5%Language:HTML 19.5%Language:JavaScript 16.1%