Universal + Express
Escalating from https://github.com/fgnass/domino/issues/153
When running a development or production server, I should see my application running.
Blank white screen with this error:
SyntaxError: strict mode code may not contain 'with' statements
Diving deep down into the error, reveals an issue with the domino package and specifically it's file sloppy.js which is using a with command which is forbidden in strict mode.
Strict mode is enabled for this file because it is packaged lower than a file that specifies a universal use strict statement.
https://github.com/fgnass/domino/blob/master/lib/sloppy.js#L10
- [ ] aspnetcore-engine
- [ ] builders
- [ ] common
- [x] express-engine
- [ ] hapi-engine
- [ ] module-map-ngfactory-loader
Create a basic Angular CLI + Universal w/ Express project. Try to run it.
ng --version output:
Angular CLI: 8.3.13
Node: 12.11.1
OS: win32 x64
Angular: 8.2.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
--------------------------------------------------------------------
@angular-devkit/architect 0.803.13
@angular-devkit/build-angular 0.803.13
@angular-devkit/build-optimizer 0.803.13
@angular-devkit/build-webpack 0.803.13
@angular-devkit/core 8.3.13
@angular-devkit/schematics 8.3.13
@angular/cli 8.3.13
@angular/platform-server 8.2.14
@ngtools/webpack 8.3.13
@nguniversal/express-engine 8.1.1
@nguniversal/module-map-ngfactory-loader 8.1.1
@schematics/angular 8.3.13
@schematics/update 0.803.13
rxjs 6.4.0
typescript 3.5.3
webpack 4.39.2
node --version output:
v12.11.1
npm --version output:
6.12.1
Same issue here. Are there any possibility to disable strict mode for specific package/dependency or any other work around until nguniversal or domino fix?
Same issue here. Are there any possibility to disable strict mode for specific package/dependency or any other work around until nguniversal or domino fix?
Unfortunately there's no way to toggle strict mode off once it's set higher up in a previous universal scope line, unless the non-strict files are separated into a different load
Will investigate. Not sure why this is an issue only for certain apps. Every Universal app should have been broken by this.
Will investigate. Not sure why this is an issue only for certain apps. Every Universal app should have been broken by this.
I will say that the Hapi Engine one found over on the Hapi repositories seems to be fine, this only seems to be an issue when creating new projects with the Express Engine.
Which honestly is the one I want to use due to team familiarity with Express if something needs to be debugged down the line, so any help regarding this matter is overwhelmingly appreciated @vikerman :D
Additional info: it seems that issue starts from version 8+ (can not reproduce with 7)
Only from version 8 we made bundleDependencies default to "all". I haven't had a chance to look at what particular scenario causes this error to surface because there are quite a number of apps that run successfully while bundling.
Workaround till I complete the investigation - You can put try putting domino in the externalDependencies list in the server build target - https://github.com/angular/angular-cli/commit/0659cf09e3cba04b3f2770a03c660517a66ce380
@RedactedProfile do you maybe have any workaround on this with ang8 setup?
@RedactedProfile do you maybe have any workaround on this with ang8 setup?
Hi @mjankucic-itk I'm gonna be perfectly honest with you, I decided to check out the Hapi implementation for ng8+ngUniversal, it's quite good, but then ultimately I just decided to forgo Universal until this issue was resolved, which should hopefully be soon
Hi, is this still an issue? I am unable to replicate this.
Hi, is this still an issue? I am unable to replicate this.
I am trying to Upgrade form Angular 8 to 9 and I am getting this same behavior. ng build error points to the following bit of code in the vendor-es2015.js:
`// "./node_modules/domino/lib/sloppy.js":
/!**************!\
!* ./node_modules/domino/lib/sloppy.js !
*************/
/! no static exports found /
/**/ (function(module, exports) {
/* Domino uses sloppy-mode features (in particular, with) for a few
@adamraetz, your issue is mostly likely related to: https://github.com/angular/angular/issues/34970#issuecomment-581838896
I'm having this issue too.
How to use now, for example BEFORE_APP_SERIALIZED from @angular/platform-server on the client?
@yumagulov-azat There should never be a case where that is required. Especially because that hook will never, and I mean _never_ trigger on the client.
Closing since @alan-agius4 provided link to the real issue.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Will investigate. Not sure why this is an issue only for certain apps. Every Universal app should have been broken by this.