Skip to content
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

Update guide #1

Closed
quanganh206 opened this issue Jun 26, 2018 · 8 comments
Closed

Update guide #1

quanganh206 opened this issue Jun 26, 2018 · 8 comments

Comments

@quanganh206
Copy link

Hi @kamilmysliwiec

When use npm run build:ssr && npm run serve:ssr we must open localhost:300O to see the result. Thanks for you hardwork. I looking for that type of project so long.

@GZ-Murphy
Copy link

Hi @kamilmysliwiec

When run serve:ssr, console in browser shows Uncaught SyntaxError: Unexpected token < , is it some issue cause by webpack? Thanks for you hardwork.

@quanganh206
Copy link
Author

No I do not see problem with webpack. Here is my package.json

"dependencies": {
"@angular/animations": "^6.0.3",
"@angular/common": "^6.0.3",
"@angular/compiler": "^6.0.3",
"@angular/core": "^6.0.3",
"@angular/forms": "^6.0.3",
"@angular/http": "^6.0.3",
"@angular/platform-browser": "^6.0.3",
"@angular/platform-browser-dynamic": "^6.0.3",
"@angular/platform-server": "^6.0.6",
"@angular/router": "^6.0.3",
"@nestjs/common": "^5.0.1",
"@nestjs/core": "^5.0.1",
"@nguniversal/common": "^6.0.0",
"@nguniversal/express-engine": "^6.0.0",
"@nguniversal/module-map-ngfactory-loader": "^6.0.0",
"core-js": "^2.4.1",
"domino": "^2.0.2",
"ng2-dragula": "^1.5.0",
"rxjs": "6.0.0",
"webpack-cli": "^2.0.14",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.8",
"@angular/cli": "~6.0.8",
"@angular/compiler-cli": "^6.0.3",
"@angular/language-service": "^6.0.3",
"@types/node": "^8.0.30",
"codelyzer": "^4.0.2",
"cpy-cli": "^1.0.1",
"express": "^4.15.2",
"http-server": "^0.10.0",
"pre-commit": "^1.2.2",
"reflect-metadata": "^0.1.10",
"ts-loader": "^4.2.0",
"tslint": "^5.7.0",
"typescript": "~2.7.2",
"webpack-cli": "^3.0.8"
}

@Splaktar
Copy link
Contributor

Splaktar commented Sep 2, 2018

If you are seeing "Uncaught ReferenceError: global is not defined", see valor-software/ng2-dragula#849.

@Splaktar
Copy link
Contributor

Splaktar commented Sep 2, 2018

I'm also seeing the same issue as @GZ-Murphy with regards to Uncaught SyntaxError: Unexpected token <, this appears to be caused by the server sending back the index.html in response to styles.xxx.css, main.xxx.js, etc. instead of the actual static resources.

@Splaktar
Copy link
Contributor

Splaktar commented Sep 2, 2018

OK, I managed to fix the Unexpected token < issue along with quite a few other problems that I ran into when trying to get this repo to run against the latest Angular. You can take a look at this commit for more details.

I'm not 100% satisfied with the prerender configuration since it doesn't seem like the cached HTTP requests from prerendering get stored/fetched properly. But I'm not sure how it was expected to work.

It doesn't look like prerendering was ever really working in this repo due to https://github.com/kamilmysliwiec/universal-nest/blob/master/static.paths.ts not mapping to the actual paths used in this app.

I had to actually fork and fix dragula since it is no longer maintained and the update to ng2-dragula pulls in a version of dragula that isn't compatible with NodeJS/Universal.

Please let me know if I could have done anything better. This is my first day of actually doing any code with Nest.

@kamilmysliwiec
Copy link
Member

Great job @Splaktar 👍 Would you like to create a PR to this repository? I'll check out, extract universal module and we can then move this whole repo under @nestjs organization :)

@Splaktar
Copy link
Contributor

Splaktar commented Sep 6, 2018

@kamilmysliwiec I would love to, but my work on this only happens in my spare time, so I am not sure when I will be able to get around to it. I didn't create a PR initially because I wasn't sure if the approach was completely correct (plus I probably changed some unrelated things as well, so I'll have to do a little clean up in a branch before PR'ing).

Please feel free to grab whatever you need/want from my fork in the meantime.

@kamilmysliwiec
Copy link
Member

Sure thing :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants