Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

universal has too many restrictions #490

Closed
8 tasks
orange4glace opened this issue Jul 22, 2016 · 6 comments
Closed
8 tasks

universal has too many restrictions #490

orange4glace opened this issue Jul 22, 2016 · 6 comments
Assignees

Comments

@orange4glace
Copy link

orange4glace commented Jul 22, 2016

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.

  • I'm submitting a ...
  • bug report
  • [ x ] 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 pull-request
  • express-engine
  • grunt-prerender
  • gulp-prerender
  • hapi-engine
  • universal-preview
  • [ x ] universal
  • webpack-prerender
  • Do you want to request a feature or report a bug?
    feature
  • What is the current behavior?
    Using universal has too many restrictions. At first, I decided to use Universal because of disapproval of adsense since adsense doesn't approve apps which uses ajax loading.
    So I immediately dived into universal. But it comes out universal has too many restrictions to be applied my app.
    My application uses jQuery things and Pusher (https://pusher.com/). ok. jquery definitely manipulate DOM directly. let's do not talk about this.
    But Pusher, even it doesn't manipulate DOM but only does window.addEventListener things and universal doesn't allow it so I can't use this either.
    Since Universal inject(or copy) every app.component and relative sources to server codes, there no way to render my app in serverside without not using Pusher of jQuery things. (and I can't use it in node because node has no document or window)
  • 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.
  • What is the expected behavior?
    there're some scripts touch document or window object, but It never affects to 'VIEW'.
    So, if there's a kind of 'exclusive' items, and universal doesn't copy that code to server code, it will be good.
  • What is the motivation / use case for changing the behavior?
    My app never works with universal :(
  • Please tell us about your environment:
  • Angular version: 2.0.0-rc.4
  • Language: TypeScript latest
  • OS: Windows
  • Platform: Nodejs
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
@MarkPieszak
Copy link
Contributor

The larger problem is that as you know jQuery manipulates the DOM, also window and document don't exist on the server-side. It's something we would surely love Universal to at least be able to ignore (since / if it can't handle it) but it's a big problem in all server side rendering solutions still. So it's definitely not an easy task unfortunately.

Just wondering, why are you using jQuery at the moment? Maybe it's possible to at least start removing those aspects for now? (You'll be happier in the long run that you did)

@PatrickJS
Copy link
Contributor

In the future I can probably provide a better experience for this at a cost of performance by creating a proxy for these globals. I understand that jQuery is used by 30% of devs so it's important to provide something that works. I have a few ideas but it needs design and a prototype. We can probably provide a solution faster using jsdom rather than parse5 at a huge cost of performance but devs can use it as a prerendering option

@PatrickJS PatrickJS self-assigned this Jul 24, 2016
@michael-jennings
Copy link

(I'm a total noob so this is by no means to be taken as a viable clue on how to move forward)

I haven't quite figured out how universal renders components server-side (at least in .net core) so I'm not sure it is possible, but is there a way to like... build a string on the server-side containing any javascript you want executed on the client, and pass it to the client through a component attribute, and have that component render itself with a script tag containing the string, so it executes? or use eval or whatever that command is to exec a js string?

@PatrickJS
Copy link
Contributor

I have a new design that would make it very easy to jump in and still support jQuery

@PatrickJS
Copy link
Contributor

closing for #512 please follow that issue

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants