We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Windows undefined with using Angular11 server side rendering
Also getting TypeError: Cannot read property 'polyfillWrapFlushCallback' of undefined
Another one is TypeError: Cannot redefine property: constructor
Is there any solution for this?
Here si my server.ts
import 'zone.js/dist/zone-node'; import { ngExpressEngine } from '@nguniversal/express-engine'; import * as express from 'express'; import { join } from 'path'; import 'node-self'; const domino = require('domino'); // const fs = require('fs'); import * as fs from 'fs'; // import { existsSync } from 'fs'; // import * as domino from 'domino'; // const template = fs.readFileSync(path.join(distFolder, 'index.html')).toString(); // Shim for the global window and document objects. const distFolder = join(process.cwd(), 'dist/browser'); const indexHtml = fs.existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index'; // const template = fs.readFileSync(join(distFolder, indexHtml)).toString(); const win = domino.createWindow(indexHtml); // console.log('Win==>',win); global['window'] = win; // global['self'] = win; global['document'] = win.document; global['HTMLElement'] = win.HTMLElement; global['navigator'] = win.navigator; import { AppServerModule } from './src/main.server'; import { APP_BASE_HREF } from '@angular/common'; // The Express app is exported so that it can be used by serverless Functions. export function app(): express.Express { const server = express(); console.log('server side'); const path = require('path'); // Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine) server.engine('html', ngExpressEngine({ bootstrap: AppServerModule, })); server.set('view engine', 'html'); server.set('views', distFolder); // Example Express Rest API endpoints // server.get('/api/**', (req, res) => { }); // Serve static files from /browser server.get('*.*', express.static(distFolder, { maxAge: '1y' })); /* server.get('*', function (req, res) { res.sendFile(join(distFolder, 'browser', 'index.html')); }); */ // All regular routes use the Universal engine server.get('*', (req, res) => { res.render(indexHtml, { req, providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }] }); }); return server; }
Polymer.version : 3.4.1 Angular version : 11 webcomponents : 2.5.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Getting Windows undefined with using Angular11 server side rendering
Also getting TypeError: Cannot read property 'polyfillWrapFlushCallback' of undefined
Another one is TypeError: Cannot redefine property: constructor
Is there any solution for this?
Here si my server.ts
Versions
Polymer.version : 3.4.1
Angular version : 11
webcomponents : 2.5.0
The text was updated successfully, but these errors were encountered: