Skip to content

Instantly share code, notes, and snippets.

View Liudmyla01's full-sized avatar

Liudmyla Bilynets Liudmyla01

  • Ukraine, Kyiv
View GitHub Profile
@michelepatrassi
michelepatrassi / server.ts
Last active February 5, 2023 13:56
Angular Universal Server Side Rendering battle tested server.ts and webpack.server.config.js files 🦁(includes Firebase, FirebaseUI, Angular i18n and log rotation)
import { RESPONSE, REQUEST } from '@nguniversal/express-engine/tokens';
import { renderModuleFactory } from '@angular/platform-server';
// These are important and needed before anything else
import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import { enableProdMode, ValueProvider, FactoryProvider } from '@angular/core';
// Import module map for lazy loading
import {provideModuleMap} from '@nguniversal/module-map-ngfactory-loader';
import { registerLocaleData } from '@angular/common';
@michelepatrassi
michelepatrassi / updated-server.ts
Last active June 14, 2022 07:47
Angular universal SSR requestAnimationFrame
// add this code to your server.ts
// implementation credits: https://gist.github.com/paulirish/1579671
global['requestAnimationFrame'] = function(callback, element) {
let lastTime = 0;
const currTime = new Date().getTime();
const timeToCall = Math.max(0, 16 - (currTime - lastTime));
const id = setTimeout(function() { callback(currTime + timeToCall); },
timeToCall);
lastTime = currTime + timeToCall;