-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: Add plugin option for custom outDir #591
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for taking a look. It wasn't a priority but obviously hard-coding dist/
everywhere is not great and I was hoping I can clean this up someday.
If you have a concrete motivation to change outDir
other than dist
, then I would like to know the reason as it helps setting the priority.
On second thought, I think trying to reuse Vite config's Probably it makes sense to not support // vite.config.ts
export default defineConfig({
plugins: [
vitePluginReactServer({
outDir: "custom-dir", // here okay
})
],
build: {
outDir: "...", // not supported here
}
}) This probably sets the expectation better and also code becomes less confusing? |
Hey, thank you so much for your detailed feedback and for taking the time to provide tips for improvement. I really appreciate your insights! Firstly, the reason for customizing the I would be happy to assist with this feature and will carefully review your comments to revise the draft accordingly. Additionally, I believe you are right that a custom plugin-scoped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the follow up! It looks about right, but I think there are a few missing on react-server-next
adapter side
export async function build({ runtime }: { runtime: VercelRuntime }) { | |
const buildDir = join(process.cwd(), "dist"); |
You can also add your example on CI. I wasn't sure if adding an entire example is worth it but for now it should be fine. You can add it to test-react-server-others
job around here:
vite-plugins/.github/workflows/ci.yml
Lines 48 to 50 in f85a833
test-react-server-others: | |
runs-on: ubuntu-latest | |
steps: |
I just approved CI run on this PR, so you can check it.
I’ve addressed your feedback and implemented the changes. I’m confident I’ve covered all the hard-coded ‘dist’ directories, and the pipeline should now pass smoothly, even with the new e2e tests. |
Awesome, code looks good to me! I might tweak tests for my own taste, but we should be able to merge this soon. Thanks a lot. If you want to test this out early, you can grab packages built from this PR here https://github.com/hi-ogawa/vite-plugins/runs/28288606525 You can use it like |
@@ -0,0 +1,12 @@ | |||
import type React from "react"; | |||
|
|||
export default function Layout(props: React.PropsWithChildren) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have default root layout (I think next.js has it?), so we need to add one here. Otherwise, ssr/hydration is failing since they expect <html>
and <body>
are rendered.
Merging. Thanks for the contribution! |
Corrected the build process to honor the user-defined
outDir
setting in the Vite configuration.