I see the angular2 app that I created is much slower (approximately ~5X) in IE11 when compared to other browsers. In IE11, right from the data rendering in a grid, dropdown, pagination are slow whereas the same is super fast and working as expected in other browsers. When I googled, I see using core-js and using enableProdMode() might improve the performance in IE. I have enabled enableProdMode() but I am not clear how to wireup core-js with the angular2 app. I have included core-js as dependency and installed it. So what would be next step to wireup things.?
My issue in angular 6 was an input binding done to a function:
<app-my-component [model]="getMyModel()"></app-my-component>
I changed that to a variable instead
<app-my-component [model]="valueOfGetMyModel"></app-my-component>
This simple change fixed a major performance issue for me. Also, the function was using a polyfilled function in IE, while other browsers had native implementation that didn't show any notable issues.
As a final fix, I also changed the changeDetection strategy to onPush as this component has 15 instances in the page.
please create angular project using angularcli commondline
use ng build --prod to compile your angular project
This will work IE same as Chrome. I have tested and working like charm in my application
Including the following libraries as part of polyfills.ts made my application faster but it never matched the performance to Chrome.
import 'core-js/client/core';
import 'zone.js/dist/zone';
import 'rxjs/bundles/Rx';
import '#angular/core/bundles/core.umd';
import '#angular/common/bundles/common.umd';
import '#angular/compiler/bundles/compiler.umd';
import '#angular/platform-browser/bundles/platform-browser.umd';
import '#angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd';`
Beware, adding these files increases the size of the bundle drastically.
Related
I've recently come across a way of importing font awesome icons which would allow the creation of a final bundle with only the icons in use FontAwesome documentation. I understand that the bundler (Vite in my case) applies tree shaking in order to create a smaller bundle.
I'm currently in the midst of developing an app that also uses flags. Thus I stumbled upon the following repository Flag Icons. I've installed the npm package and added the stylesheet to index.html. Everything works as expected.
Does using the library this way mean I imported all the flags in my project, even the ones I won't use? Is there a way I can create a smaller bundle with the ones I'm going to use?
I recently started working on Nativescript. I found NathanWalker's angular-seed-advanced quite interesting. I am facing one issue in that. How do I import mobile specific nativescript's plugin in my components as that component is being used for web app too.
If I import directly nativescript plugins in src/client/app/components then Web app will not work as expected. I need to know how to import plugin safely so that both web app and mobile app work as expected
You can import mobile specific items in Root module file which is - native.module.ts.
Code organization section in the same seed project read me file gives good picture of what file is for what, including the above one.
Hope this helps :)
TL;DR:
Using Rollup, can I import D3 like Debug or can I only build a custom library?
Background
I'm trying to build my first webapp with Rollup, D3 (v4 - ES2015) and others. In search of an education, I followed Jason Lengstorf's tutorial. There I learned how to import Debug (CommonJS) and use its facilities. Works like a champ. I then tried to use D3 in the same way, only there are no default exports so used import * as d3 from 'd3' instead of the import debug from debug-style. For love or money I can't get it to work. I keep getting errors that look like:
'request' is not exported by
node_modules/d3-request/build/d3-request.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
I opened an issue with the Rollup guys. They are busy and gave me what they could — and I remain stumped. Both of Mike Bostock's examples (I and II) just show how to build custom bundles, not how to import into working code a la Debug (which is, again, CommonJS not ES2015 like D3). Is that the only way to use it? I have not experimented with another ES2015 library (not that I know any) so I don't know if this is D3-specific or I just don't understand how to deal with ES2015 libraries generally (or just simply don't understand browser-based architecture period).
Follow-on questions
Is there a web app architecture tutorial/book/something that includes ES2015-specific issues?
There seems to be as many project structures out there as people coding. Is there One True Church? Do I just have to keep bleeding from my eyes until I get my own, phoenix-like kung fu about all this (reference Jose Aguinaga's piece)?
After recently updating my project to meteor 1.2 and including the new ecmascript package (to use ES2015 features), I realized that my server debug breakpoints will never run, no matter what I do.
After reading about different ES6 posts on meteor forums and jetbrains , I tried setting up file watchers to create sourcemaps, but:
meteor complains about the generated files(so you have to move them to special folders in order to keep going)
It still doesn't work :(
Setting up spy-js also didn't work (never tried before so maybe I did it wrong)
I could reproduce the problem with the basic TODOs application and debugging with default options.
It is fixed for now in EAP 11 builds.
Known issue, please follow WEB-18074 for updates. Unfortunately I can't offer any workarounds:(
This is a boiled-down repro of a problem I'm having in a much larger app. I can't seem to find a solution for it. If you run this in IE8, the ui-popup directive doesn't work, and the script debugger console has the error message "TypeError: Object doesn't support this property or methodundefined".
I tried to strip away as many directives, controllers, and as much code as possible.
jsFiddle Link
If you downgrade angularjs to 1.0.3 it works in ie8.
Edit
Angular 1.0.5 also works.