Closed v4ssi404 closed 2 years ago
hey Alberto, I'll admit I'm not a typescript or angular guy, so I may not be much help here.
Are you on 6.16.2
?
I get import * as spacetime
working in vanilla node. Do you suspect this is an error with the typescript types, or with babel/whatever angular uses to build?
@jecraig any thoughts?
cheers
I tried creating a new Angular Universal app and had no issues.
Thank you both for your time.
Yes @spencermountain i was on 6.16.2
but i have now updated to the 6.16.3
.
@jecraig i have checked your DemoApp, i tried to change your app settings to angular 8 version but "playing" with your app trying to reproduce the problem i figured out that the problem it's probably in my tsconfig.server.json
This is mine, if i remove module
and instead i add "target": "es2015"
the error disapper, if you think this could be legit? Thank you.
{
"extends": "./tsconfig.app.json",
"compilerOptions": {
"outDir": "./out-tsc/app-server",
"module": "commonjs"
},
"files": [
"src/main.server.ts"
],
"angularCompilerOptions": {
"entryModule": "./src/app/app.server.module#AppServerModule"
}
}
Those options are all about setting how the modules are loaded. Frankly, I'm no expert on it, but changing your module resolution is legit.
Ok thank you! I will try it.
Hello,
i am issuing an error similar to this one #https://github.com/spencermountain/spacetime/issues/144
Basically i am importing spacetime in this way:
import spacetime from 'spacetime;
And this works without problem if i use
ng serve
but it breaks SSR that gives me:ERROR TypeError: Cannot read property 'now' of undefined
If i change the import to:
const spacetime = require('spacetime')
the error disappear into the SSR but i get in console the error:
spacetime.now is not a function
Instead if i use this breaks everything.
import * as spacetime from 'spacetime'
Any advice?
I am using Angular 8 and Angular Universal 9.1.1.
My
tsconfig.json
is:Thank you!