fix(vite): Respect host
, sourceMap
settings in redwood.toml on vite dev server
#7606
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on user feedback. This PR does two things:
1. Host is respected
The vite plugin now respects the host specified in
redwood.toml
. Note that when we specify the host to be0.0.0.0
vite will still print that its running on localhost but actually listen on all hosts, as per this doc: https://vitejs.dev/config/server-options.html#server-host2. Sourcemap setting for production build is respected
If you want to generate sourcemaps for production, this is now respected. The key changes here were
a) Passing through the sourceMap option from
redwood.toml
through to Vite's build settingsb) Making sure any custom transforms, in this case the html transformer (bundle injection), preserves the original sourcemap.
The information on this was a little hard to find, but is in the rollup documentation: https://rollupjs.org/plugin-development/#transform