Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 24cb5ca

Browse files
authored
refactor(): delete all optimizations, use the angular devkit instead
* fix(optimization): removing optimizations in preparation for ngo, updating to latest deps * tmp * wip * wip * refactor(): deprecate rollup, closure, and babili support * refactor(config): remove deprecated configuration options * fix(postprocess): fix and add tests for the logic surrounding purging fonts
1 parent 118189c commit 24cb5ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+433
-13879
lines changed

README.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,10 @@ npm run build --rollup ./config/rollup.config.js
9393

9494
| Config File | package.json Config | Cmd-line Flag |
9595
|-------------|---------------------|-----------------------|
96-
| Babili | `ionic_use_experimental_babili` | `--babili` |
9796
| CleanCss | `ionic_cleancss` | `--cleancss` or `-e` |
9897
| Copy | `ionic_copy` | `--copy` or `-y` |
99-
| Closure | `ionic_closure` | `--closure` or `-l` |
10098
| Generator | `ionic_generator` | `--generator` or `-g` |
10199
| NGC | `ionic_ngc` | `--ngc` or `-n` |
102-
| Rollup | `ionic_rollup` | `--rollup` or `-r` |
103100
| Sass | `ionic_sass` | `--sass` or `-s` |
104101
| TSLint | `ionic_tslint` | `--tslint` or `-i` |
105102
| UglifyJS | `ionic_uglifyjs` | `--uglifyjs` or `-u` |
@@ -131,14 +128,8 @@ npm run build --rollup ./config/rollup.config.js
131128
| bail on lint error | `ionic_bail_on_lint_error` | `--bailOnLintError` | `null` | Set to `true` to make stand-alone lint commands fail with non-zero status code |
132129
| enable type checking during lint | `ionic_type_check_on_lint` | `--typeCheckOnLint` | `null` | Set to `true` to enable [type checking](https://palantir.github.io/tslint/usage/type-checking) during lint |
133130
| write AoT files to disk | `ionic_aot_write_to_disk` | `--aotWriteToDisk` | `null` | Set to `true` to write files to disk for debugging |
134-
| print dependency tree | `ionic_print_original_dependency_tree` | `--printOriginalDependencyTree` | `null` | Set to `true` to print out the original dependency tree calculated during the optimize step |
135-
| print modified dependency tree | `ionic_print_modified_dependency_tree` | `--printModifiedDependencyTree` | `null` | Set to `true` to print out the modified dependency tree after purging unused modules |
136131
| print webpack dependency tree | `ionic_print_webpack_dependency_tree` | `--printWebpackDependencyTree` | `null` | Set to `true` to print out a dependency tree after running Webpack |
137132
| parse deeplink config | `ionic_parse_deeplinks` | `--parseDeepLinks` | `true` | Parses and extracts data from the `@IonicPage` decorator |
138-
| manual tree shaking | `ionic_manual_treeshaking` | `--manualTreeshaking` | `true` | Set to `true` to purge unused Ionic components/code |
139-
| purge decorators | `ionic_purge_decorators` | `--purgeDecorators` | `true` | Set to `true` to purge unneeded decorators to improve tree shakeability of code |
140-
| experimental closure compiler | `ionic_use_experimental_closure` | `--useExperimentalClosure` | `null` | Set to `true` to use closure compiler to minify the final bundle |
141-
| experimental babili | `ionic_use_experimental_babili` | `--useExperimentalBabili` | `null` | Set to `true` to use babili to minify es2015 code |
142133
| convert bundle to ES5 | `ionic_build_to_es5` | `--buildToEs5` | `true` | Convert bundle to ES5 for for production deployments |
143134
| default watch timeout | `ionic_start_watch_timeout` | `--startWatchTimeout` | `3000` | Milliseconds controlling the default watch timeout |
144135
| choose the polyfill | `ionic_polyfill_name` | `--polyfillName` | `polyfills` | Change with polyfills.modern or polyfills.ng (all options)[https://github.com/driftyco/ionic/tree/master/scripts/polyfill] |
@@ -179,14 +170,8 @@ These environment variables are automatically set to [Node's `process.env`](http
179170
| `IONIC_BAIL_ON_LINT_ERROR` | Boolean determining whether to exit with a non-zero status code on error |
180171
| `IONIC_TYPE_CHECK_ON_LINT` | Boolean determining whether to type check code during lint or not |
181172
| `IONIC_AOT_WRITE_TO_DISK` | `--aotWriteToDisk` | `null` | Set to `true` to write files to disk for debugging |
182-
| `IONIC_PRINT_ORIGINAL_DEPENDENCY_TREE` | boolean to print out the original dependency tree calculated during the optimize step |
183-
| `IONIC_PRINT_MODIFIED_DEPENDENCY_TREE` | boolean to print out the modified dependency tree after purging unused modules |
184173
| `IONIC_PRINT_WEBPACK_DEPENDENCY_TREE` | boolean to print out a dependency tree after running Webpack |
185174
| `IONIC_PARSE_DEEPLINKS` | boolean to enable parsing the Ionic 3.x deep links API for lazy loading |
186-
| `IONIC_MANUAL_TREESHAKING` | boolean to enable purging unused Ionic components/code |
187-
| `IONIC_PURGE_DECORATORS` | boolean to enable purging unneeded decorators from source code |
188-
| `IONIC_USE_EXPERIMENTAL_CLOSURE` | boolean to enable use of closure compiler to minify the final bundle |
189-
| `IONIC_USE_EXPERIMENTAL_BABILI` | boolean to enable use of babili to minify es2015 code |
190175
| `IONIC_BUILD_TO_ES5` | boolean to enable converting bundle to ES5 for for production deployments |
191176
| `IONIC_START_WATCH_TIMEOUT` | Milliseconds controlling the default watch timeout |
192177

@@ -240,7 +225,7 @@ npm run lint --bailOnLintError true
240225
- [Ionic Framework](https://ionicframework.com/)
241226
- [TypeScript Compiler](https://www.typescriptlang.org/)
242227
- [Angular Compiler (NGC)](https://github.com/angular/angular/tree/master/modules/%40angular/compiler-cli)
243-
- [Rollup Module Bundler](https://rollupjs.org/)
228+
- [Webpack Module Bundler](https://webpack.js.org/)
244229
- Ionic Component Sass
245230
- [Node Sass](https://www.npmjs.com/package/node-sass)
246231
- [Autoprefixer](https://github.com/postcss/autoprefixer)

config/optimization.config.js

Lines changed: 0 additions & 41 deletions
This file was deleted.

config/webpack.config.js renamed to config/webpack.config.dev.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ var path = require('path');
22
var webpack = require('webpack');
33
var ionicWebpackFactory = require(process.env.IONIC_WEBPACK_FACTORY);
44

5-
var ModuleConcatPlugin = require('webpack/lib/optimize/ModuleConcatenationPlugin');
6-
7-
var prodPlugins = [];
8-
if (process.env.IONIC_ENV === 'prod') {
9-
prodPlugins.push(new ModuleConcatPlugin());
10-
}
11-
125
module.exports = {
136
entry: process.env.IONIC_APP_ENTRY_POINT,
147
output: {
@@ -33,18 +26,14 @@ module.exports = {
3326
{
3427
test: /\.ts$/,
3528
loader: process.env.IONIC_WEBPACK_LOADER
36-
},
37-
{
38-
test: /\.js$/,
39-
loader: process.env.IONIC_WEBPACK_TRANSPILE_LOADER
4029
}
4130
]
4231
},
4332

4433
plugins: [
4534
ionicWebpackFactory.getIonicEnvironmentPlugin(),
46-
ionicWebpackFactory.getCommonChunksPlugin(),
47-
].concat(prodPlugins),
35+
ionicWebpackFactory.getCommonChunksPlugin()
36+
],
4837

4938
// Some libraries import Node modules but don't use them in the browser.
5039
// Tell Webpack to provide empty mocks for them so importing them works.

config/webpack.config.prod.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
var path = require('path');
2+
var webpack = require('webpack');
3+
var ionicWebpackFactory = require(process.env.IONIC_WEBPACK_FACTORY);
4+
5+
var ModuleConcatPlugin = require('webpack/lib/optimize/ModuleConcatenationPlugin');
6+
var PurifyPlugin = require('@angular-devkit/build-optimizer').PurifyPlugin;
7+
8+
module.exports = {
9+
entry: process.env.IONIC_APP_ENTRY_POINT,
10+
output: {
11+
path: '{{BUILD}}',
12+
publicPath: 'build/',
13+
filename: '[name].js',
14+
devtoolModuleFilenameTemplate: ionicWebpackFactory.getSourceMapperFunction(),
15+
},
16+
devtool: process.env.IONIC_SOURCE_MAP_TYPE,
17+
18+
resolve: {
19+
extensions: ['.ts', '.js', '.json'],
20+
modules: [path.resolve('node_modules')]
21+
},
22+
23+
module: {
24+
loaders: [
25+
{
26+
test: /\.json$/,
27+
loader: 'json-loader'
28+
},
29+
{
30+
test: /\.js$/,
31+
loader: [
32+
{
33+
loader: process.env.IONIC_CACHE_LOADER
34+
},
35+
36+
{
37+
loader: '@angular-devkit/build-optimizer/webpack-loader',
38+
options: {
39+
sourceMap: true
40+
}
41+
},
42+
]
43+
},
44+
{
45+
test: /\.ts$/,
46+
loader: [
47+
{
48+
loader: process.env.IONIC_CACHE_LOADER
49+
},
50+
51+
{
52+
loader: '@angular-devkit/build-optimizer/webpack-loader',
53+
options: {
54+
sourceMap: true
55+
}
56+
},
57+
58+
{
59+
loader: process.env.IONIC_WEBPACK_LOADER
60+
}
61+
]
62+
}
63+
]
64+
},
65+
66+
plugins: [
67+
ionicWebpackFactory.getIonicEnvironmentPlugin(),
68+
ionicWebpackFactory.getCommonChunksPlugin(),
69+
new ModuleConcatPlugin(),
70+
new PurifyPlugin()
71+
],
72+
73+
// Some libraries import Node modules but don't use them in the browser.
74+
// Tell Webpack to provide empty mocks for them so importing them works.
75+
node: {
76+
fs: 'empty',
77+
net: 'empty',
78+
tls: 'empty'
79+
}
80+
};

0 commit comments

Comments
 (0)