Closed jorgjanke closed 6 years ago
I just tried this with the Universal Starter we only got this error:
The type attribute is unnecessary for JavaScript resources.
Which is unrelated to Universal, that's an issue with the CLI not with Universal itself
Could you provide a minimal reproduction?
Using the Universal Starter as a baseline
I think the problem is (in app.module.ts):
PrebootModule.withConfig({
appRoot: 'app-root'
}),
The functions in the script tag include
function waitUntilReady(data, win) {..}
function start(prebootData, win) {..}
function createOverlay(_document) {..}
function getAppRoots(_document, opts) {..}\
After commenting out the PrebootModule, the index.html did not have the script tag.
So the problem is that generating the PrebootModule, creates the code directly in the index.html file rather creating a js file and then referencing that file.
Sounds like an issue with preboot, we have no control here over what code generated there
Closing this as it appears to not be an issue with Universal
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.
Note: for support questions, please use one of these channels: https://github.com/angular/universal/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports. Also, Preboot has moved to https://github.com/angular/preboot - please make preboot-related issues there.
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, see note at the top of this template.
What modules are related to this Issue?
[x] prerender.ts
[ ] aspnetcore-engine
[ ] express-engine
[ ] hapi-engine
Do you want to request a feature or report a bug? bug
What is the current behavior? when using the suggested prerender.ts script, the generated index.html fails the validator.w3.org (and others). The cause is that the generated javascript is before meta tags.
Nu Html Checker output: . Error: The character encoding was not declared. Proceeding using windows-1252. . Error: A charset attribute on a meta element found after the first 1024 bytes. . Error: Changing character encoding utf-8 and reparsing. . Fatal Error: Changing encoding at this point would need non-streamable behavior.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem by creating a github repo.
use example repro
submit resulting index.html to validator.w3.org
What is the expected behavior? pass w3 validation I assume that parsing the html and finding the right spot is too hard, so the "cheap options" are . - search for a tag like
<!-- universal scripts -->
and put the scripts there if found . - create scripts in a separate file (not ideal)What is the motivation / use case for changing the behavior? . pass static html validators . seo
Please tell us about your environment:
Angular version: 5.1.3
Browser: [all]
Language: [all]
OS: [all ]
Platform: [all | NodeJs | Java | PHP | .NETCore | Ruby]
Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)