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

support Vite's base config when using the dev server #489

Merged
merged 9 commits into from
Jan 20, 2023

Conversation

DeedleFake
Copy link
Contributor

  • Quick Checklist
  • I have read the contributing guidelines
  • I have written new tests, as applicable (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • I have added a changeset, if applicable
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

It adds support for Vite's base config in the dev server. This fixes issues with serving assets through imagetools when using a custom backend, such as Rails.

Fixes #396.

  • What is the new behavior (if this is a feature change)?

The URL prefix used to watch for imagetools requests is now ${viteConfig.base}/@imagetools/ instead of just /@imagetools/. This allows for things like Rails to properly forward those requests to the Vite dev server.

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this
    PR?)

I don't think so, no.

@changeset-bot
Copy link

changeset-bot bot commented Jan 17, 2023

🦋 Changeset detected

Latest commit: a0f8876

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

This PR includes changesets to release 1 package
Name Type
vite-imagetools Patch

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

@codecov
Copy link

codecov bot commented Jan 18, 2023

Codecov Report

Merging #489 (479afe7) into main (c64e7ef) will increase coverage by 0.00%.
The diff coverage is 40.00%.

❗ Current head 479afe7 differs from pull request most recent head a0f8876. Consider uploading reports for the commit a0f8876 to get more accurate results

@@           Coverage Diff           @@
##             main     #489   +/-   ##
=======================================
  Coverage   96.74%   96.75%           
=======================================
  Files          31       31           
  Lines        1107     1109    +2     
  Branches      222      222           
=======================================
+ Hits         1071     1073    +2     
  Misses         36       36           
Flag Coverage Δ
imagetools-core 98.68% <ø> (ø)
rollup-plugin-imagetools 99.23% <ø> (ø)
vite-imagetools 83.33% <40.00%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/vite/src/index.ts 83.33% <40.00%> (+0.23%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@DeedleFake
Copy link
Contributor Author

Is there anything else you'd like me to do before this can be merged? My current workaround involves manually building vite-imagetools and then repackaging as a minimal local package so that I can use the fixed version, and I'd very much prefer to be able to use the actual package itself.

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
@benmccann benmccann merged commit 6291c71 into JonasKruckenberg:main Jan 20, 2023
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.

Images don't show in dev mode with Laravel backend
3 participants