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(dev/plugin)!: redo reverse proxy setup #376

Merged
merged 10 commits into from
Aug 18, 2023
Merged

fix(dev/plugin)!: redo reverse proxy setup #376

merged 10 commits into from
Aug 18, 2023

Conversation

mkilpatrick
Copy link
Collaborator

Prior to this change, assets were imported relatively, also taking into account relativePathToPrefix. While this generally worked, there were other issues due to Vite's build optimizations: specifically module preloading and inline assets. Due to this we decided to take a new approach where assets are now imported absolutely and it's now up to the RP config to handle the assets. A working example of a Netlify setup for a RP at the subdirectory subfolder looks like this:

[[redirects]]
  from = "/subdirectory/assets/*"
  to = "https://rp-test.pagesprod.yextengtest.com/subdirectory/assets/:splat"
  status = 200
  force = true
  headers = {Host = "https://rp-test.pagesprod.yextengtest.com/"}
  
[[redirects]]
  from = "/subdirectory/*"
  to = "https://rp-test.pagesprod.yextengtest.com/:splat"
  status = 200
  force = true
  headers = {Host = "https://rp-test.pagesprod.yextengtest.com/"}
  
[[redirects]]
  from = "/subdirectory"
  to = "https://rp-test.pagesprod.yextengtest.com/index.html"
  status = 200
  force = true
  headers = {Host = "https://rp-test.pagesprod.yextengtest.com/"}

In order to properly configure the Vite side, a user must set the assetsDir in the vite.config.js (subdirectory/assets for the above example) or in the config.yaml (which will be globally supported in some upcoming PRs).

Other changes in the PR include a massive refactor of ProjectStructure in order to simplify its usage and is now being used everywhere, meaning that all filenames and folders are fully configurable.

@mkilpatrick mkilpatrick requested a review from a team as a code owner August 17, 2023 16:14
Copy link
Contributor

@mancusi mancusi left a comment

Choose a reason for hiding this comment

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

LGTM for the stuff i haven't yet commented on but still a few unresolved conversations

@mkilpatrick mkilpatrick merged commit a640802 into main Aug 18, 2023
4 checks passed
@mkilpatrick mkilpatrick deleted the structure branch August 18, 2023 19:56
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.

2 participants