Since when having differential loading we already know which files originated from which build. We shouldn't need to merge and transform this data.
With this change, the index generator accepts a couple of new inputs.
1. `files` - used for Js and CSS files which require nomodule nor module attributes
2. `moduleFiles` - Js files that need to have a `module` attribute
3. `noModuleFiles` - Js files that need to have a `nomodule` attribute
4. `entrypoints` - used to sort the insertion of files in the HTML file
This PR adds differential loading to the browser builder. First, it checks if differential loading is needed. This is the case if the compilation target is ES2015 while the browserslist points to ES5 browsers.
For providing differential loading, it calls the methods for creating the webpack config for each compilation target (e. g. ES5 and ES2015). The needed differences between those configurations are defined using parameters also added by this PR. Then it calls webpack for each of them and merges the results
This feature is currently hidden behind a flag. To activate it, set the differentialLoading flag in browser/index.ts.
Currently, the IndexHtmlWebpackPlugin generates the index.html file *during* bundling. However, to support differential loading the builder must do this *after* bundling because only then we know the produced files for ES5, ES2015, etc.
Hence, this extracts the IndexHtmlWebpackPlugin logic to a helper function which can still be called by IndexHtmlWebpackPlugin for use cases not affected by differential loading (e. g. ng serve) as well as directly by the builder.
https://docs.google.com/document/d/13k84oGwrEjwPyAiAjUgaaM7YHJrzYXz7Cbt6CwRp9N4/edit?ts=5c652052
If a custom path is provided the webpack dev server client drops the sockjs-node segment. This adds it back so that behavior is consistent when using a custom URL path.
Fixes#13627
This feature ONLY matches the format below:
```
loadChildren: () => import('IMPORT_STRING').then(m => m.EXPORT_NAME)
```
It will not match nor alter variations, for instance:
- not using arrow functions
- not using `m` as the module argument
- using `await` instead of `then`
- using a default export (https://github.com/angular/angular/issues/11402)
The only parts that can change are the ones in caps: IMPORT_STRING and EXPORT_NAME.
BREAKING CHANGE: we no longer use `node-sass` by default, instead we use `sass` (dart-sass).
While in most cases this should not have an impact the generated code, dart sass has some differences from Ruby Sass. See https://github.com/sass/dart-sass#behavioral-differences-from-ruby-sass for more details
If you wish to use `node-sass` instead of `sass` you need to install node-sass as a dev dependency.
npm users
```
npm install node-sass --save-dev
```
yarn users
```
yarn add node-sass --dev
```
**Note:** for larger Sass projects to avoid this performance hit you might want to install `fibers`. See: https://www.npmjs.com/package/fibers
Ref: TOOL-748
The `getNonAotConfig` and `getNonAotTestConfig` functions are equivalent in regards to behavior. The `extract` optional parameter for `_createAotPlugin` is false by default.
For runtime i18n with ivy we generate code for both Closure compiler (used at Google) and for external people that don't use Closure compiler.
We added a new global flag named `ngI18nClosureMode` that allows uglify (and Closure compiler) to effectively tree-shake all of the code that isn't used in the current setup.
By default we remove all of the Closure compiler code because we assume that it won't be used.
At the moment when `font` shorthand property is used a warning is emitted when using this syntax
```
font: 10px "Font Awesome";
```
This should be addressed by clean-css
Fixes#9648
This changes fixes `Error: You must pass in a NgModule or NgModuleFactory to be bootstrapped`.
At the moment the check for absolute path is not correct for windows.
Fixes#13865 and fixes https://github.com/angular/universal/issues/1139