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(vite): Respect host, sourceMap settings in redwood.toml on vite dev server #7606

Merged
merged 4 commits into from
Feb 10, 2023

Conversation

dac09
Copy link
Contributor

@dac09 dac09 commented Feb 10, 2023

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 be 0.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-host

2. 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 settings
b) 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

If the transformation does not move code, you can preserve existing sourcemaps by setting map to null

@dac09 dac09 added the release:fix This PR is a fix label Feb 10, 2023
@dac09 dac09 changed the title fix(vite): Respect host specified in redwood.toml on vite dev server fix(vite): Respect host, sourceMap settings in redwood.toml on vite dev server Feb 10, 2023
@jtoar jtoar added this to the next-release-patch milestone Feb 10, 2023
@jtoar jtoar merged commit 64dff3e into redwoodjs:main Feb 10, 2023
jtoar pushed a commit that referenced this pull request Feb 13, 2023
…te dev server (#7606)

* fix(vite): Respect host specified in redwood.toml on vite dev server

* fix(vite): Generate sourcemaps in production when enabled in toml
jtoar pushed a commit that referenced this pull request Feb 13, 2023
…te dev server (#7606)

* fix(vite): Respect host specified in redwood.toml on vite dev server

* fix(vite): Generate sourcemaps in production when enabled in toml
@jtoar jtoar modified the milestones: next-release-patch, v4.1.3 Feb 13, 2023
jtoar pushed a commit that referenced this pull request Feb 13, 2023
…te dev server (#7606)

* fix(vite): Respect host specified in redwood.toml on vite dev server

* fix(vite): Generate sourcemaps in production when enabled in toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants