-
-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
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
new version with angular universal 11 #727
Comments
Thank you for feedback, I'll check. |
I have the same problem. When will the solution be ? |
In my case is with Angular Universal 9 |
@kevinvarela for now you can just change package.json : |
@mbabaei0 Thank you for your help. It works perfect. |
Affects Angular Universal >= 8 from my testing. Replicated 6.4.0 The issue seems to come and go a lot. Try the solutions here: |
@VadimDez here is what is causing the issue: see lines in this diff. |
@markhughes thanks, I was already kinda sure where the problem is, but not sure how to fix it yet 😔 |
|
@mlauinger try setting up this: https://github.com/fgnass/domino |
quick resource to help you: https://dev.to/danywalls/how-keep-your-document-object-in-angular-ssr-with-domino-package-2b9e |
Setting up with domino doesn't work for this particular issue either. |
@jakubkeller can you show your implementation? This worked for me. |
server.ts import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import { join } from 'path';
import { readFileSync } from 'fs';
import * as domino from 'domino';
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();
const distFolder = join(process.cwd(), 'dist/browser');
const indexView = 'index';
const template = readFileSync(join(distFolder, 'index.html')).toString();
const wnd: any = domino.createWindow(template);
wnd.Object = Object;
wnd.Math = Math;
global['window'] = wnd;
global['document'] = wnd.document;
global['branch'] = null;
global['object'] = wnd.object;
global['Event'] = wnd.Event;
global['KeyboardEvent'] = window.KeyboardEvent;
wnd.requestAnimationFrame = () => {};
// ...
// Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
const moduleFilename = mainModule && mainModule.filename || '';
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run();
}
import 'zone.js/dist/zone-node';
import { AppServerModule } from './src/main.server';
export * from './src/main.server'; shared.module.ts // ...
import { PdfViewerModule } from 'ng2-pdf-viewer';
@NgModule({
imports: [
CommonModule,
FormsModule,
NgSelectModule,
NgbModule,
NgxMaskModule,
NgxPaginationModule,
ReactiveFormsModule,
RouterModule,
UiSwitchModule,
PdfViewerModule
// ...
})
export class SharedModule { } |
@jakubkeller but what is your error? judging by this, |
@markhughes Sorry it took me a bit. Got the entire error stack as well, hope it helps. Otherwise, the application works when I comment out just the
|
@markhughes any traction on this? |
@jakubkeller not sure, you don't have document defined early enough or in the right cirumstances.
Try defining it earlier. |
@arturovt didn't you have some ideas on how to make so that it also works also with |
Yeah, sure, I have some idea and will try to implement it, not promising that it'll be successful 😄 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale, still an issue |
Hi guys, any update on that issue ? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
Hi, any update on that issue? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I have struggled with it a while ago and stomped back since I was upgrading this library among everything during code maintaining.
To your server.ts Cheers. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
@jakubkeller any solution for this?? |
I've posted a workaround. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale, still an issue |
@remy33 should we revert to 6.3.2, current version being 8.0.2? |
Maybe things have changed, but this is how I manage to have it work.
בתאריך יום ו׳, 26 באוג׳ 2022 ב-16:50 מאת Alfonso Moscato <
***@***.***>:
… @remy33 <https://github.com/remy33> should we revert to 6.3.2, current
version being 8.0.2?
—
Reply to this email directly, view it on GitHub
<#727 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD2TRA2NGH2PJKVRJ3SG3UDV3DDRDANCNFSM4XX34PHQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Not stale |
Not stale. Stil an issue. |
Bug Report or Feature Request (mark with an
x
)The text was updated successfully, but these errors were encountered: