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

Fix public path of static assets #909

Merged
merged 7 commits into from Mar 10, 2022
Merged

Fix public path of static assets #909

merged 7 commits into from Mar 10, 2022

Conversation

luisherranz
Copy link
Member

@luisherranz luisherranz commented Mar 9, 2022

What:

Fix the public path of the assets (images, fonts, css...).

Why:

After the switch to dynamic public paths (#890), they public path of the static assets was not working correctly anymore.

How:

It seems like changing the dynamic public path (__webpack_public_path__) at request time is not possible, so I'm just doing a string replace in the SSRed HTML.

Tasks:

  • Code
  • End to end tests
  • Add a changeset (with link to its Feature Discussion if it exists)
  • Update community discussions (this)

Unrelated Tasks

  • TSDocs
  • TypeScript
  • Unit tests
  • TypeScript tests
  • Update starter themes
  • Update other packages

Additional Comments

@luisherranz luisherranz self-assigned this Mar 9, 2022
@changeset-bot
Copy link

changeset-bot bot commented Mar 9, 2022

🦋 Changeset detected

Latest commit: adeee80

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@luisherranz luisherranz marked this pull request as ready for review March 9, 2022 17:01
@luisherranz
Copy link
Member Author

I've fixed an unrelated problem with the Google Ad Manager E2E tests.

@luisherranz
Copy link
Member Author

@luisherranz luisherranz changed the title Fix assets public path Fix public path of static assets Mar 9, 2022
@AsadZahed
Copy link

@luisherranz i updated the frontity code same as you did it in pull request but some of the images have appeared, most of them are still missing. The path on missing images is written as attached in below picture:
errorimage
I updated these files:

  • Public-path.ts
  • server-side-rendering.ts
  • index.ts

@luisherranz
Copy link
Member Author

Thanks, @AsadZahed. My mistake, it should be a global replace. I'll fix it right away 🙂

Copy link
Member

@SantosGuillamot SantosGuillamot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🙂

@luisherranz
Copy link
Member Author

Thanks Mario.

@luisherranz luisherranz merged commit ffcd532 into dev Mar 10, 2022
@luisherranz luisherranz deleted the fix-assets-public-path branch March 10, 2022 15:34
@frontibotito frontibotito mentioned this pull request Mar 10, 2022
@AsadZahed
Copy link

HI @luisherranz Thanks for the update, i just moved to new version but the font has still issues on reload of the page. I will be thankful if you look into it.

@luisherranz
Copy link
Member Author

Would you mind opening a new issue with information about the problem?

Copy link
Collaborator

@orballo orballo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me :)
EDIT: Too late xD

@luisherranz
Copy link
Member Author

luisherranz commented Mar 29, 2022

Setting the public path to __webpack_public_path__ in the server may not work in all cases: #913

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

Successfully merging this pull request may close these issues.

The public directory path of imported assets are not being loaded correctly
4 participants