question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading an assets file with relative path

See original GitHub issue
  • I’m submitting a …
- [X ] bug report
- [ ] feature request
- [ ] support request 
  • What modules are related to this Issue?
- [ ] aspnetcore-engine
- [x ] express-engine
- [ ] hapi-engine
  • Do you want to request a feature or report a bug? Bug

  • What is the current behavior? When trying to load assets files (json) from the assets folder with a relative path, the Universal version of our application fails to load them. The client version works fine. The files are intended to load via a service which is initiated via APP_INITIALIZER. The service starts up and works fine, just the files cant be loaded. Unless you load them with an absolute path (http://localhost:4000/assets…)

  • 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? The expected behaviour would be that the files load as they do in the client version

  • Please tell us about your environment:

  • Angular version: 5.0
  • Browser: [all]
  • OS: [Mac OS X | Windows ]
  • Platform: [all | NodeJs ]

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:4
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
restfulheadcommented, Oct 1, 2021

@stasberkov This works great with the Express server side rendering. However, it does not work for prerender. In that case REQUEST is empty, as there seem to be no requests (see https://github.com/angular/universal/issues/2147#issuecomment-852775977).

2reactions
michaeljotacommented, Apr 29, 2018

@Toxicable just to add, that if you are using the prerender api then, you need to load the full express server to be able to use the HttpInterceptor hack, because it won’t work otherwise. Just like @OCCGU example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 5 fix relative path for Assets/ folder - Stack Overflow
My first issue was when calling a service from the browser, it was using http://localhost:7777/ as base URL, quickly resolved by removing the ......
Read more >
Do absolute paths always point to remote files or assets?
No. Absolute paths may also be used to point to local files or assets. However, when linking to local files it generally makes...
Read more >
How to solve vue.js prod build assets relative path problem
I looked into the browser console and saw that none of the CSS and JS files loaded because of the reference problem. below...
Read more >
Scripting API: Resources.Load - Unity - Manual
The path is relative to any folder named Resources inside the Assets folder of your project. More than one Resources folder can be...
Read more >
Relative paths in dynamic creatives - Studio Help
In your dynamic feed, enter the direct file names under the column defined for your asset URLs. See Create your dynamic feed to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found