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

Add FileSystem-based router plugin by default when frontend build is needed #18832

Closed
Tracked by #5012
mshabarov opened this issue Feb 29, 2024 · 3 comments · Fixed by #18878
Closed
Tracked by #5012

Add FileSystem-based router plugin by default when frontend build is needed #18832

mshabarov opened this issue Feb 29, 2024 · 3 comments · Fixed by #18878

Comments

@mshabarov
Copy link
Contributor

mshabarov commented Feb 29, 2024

Describe your motivation

Hilla's FS-based router plugin is supposed to be added by hand:

  • run "npm i @vaadin/hilla-file-router" (should be double checked, because Hilla might make this already)
  • add the "vitePluginFileSystemRouter" Vite plugin into vite.config.ts:
       const customConfig: UserConfigFn = (env) => ({
          plugins: [vitePluginFileSystemRouter()]
       });

This would also trigger a file views.js that is needed for routes.tsx.

We can start by adding this plugin always and investigate possible impact on Flow users.
Then we can consider adding it only when Hilla is used.

Describe the solution you'd like

Flow adds this plugin into generated Vite config and adds it's package to package.json.

Additional context

Vaadin 24.4.

@knoobie
Copy link
Contributor

knoobie commented Feb 29, 2024

This should be done by default, so whenever Flow starts the frontend build (Vite dev server or new bundle build), the plugin is installed and applied.

Only if Hilla is used, right? :)

@mshabarov
Copy link
Contributor Author

mshabarov commented Feb 29, 2024

Well, yes. Not needed for bundle and basically when Hilla not used. Let me correct.

@tltv tltv self-assigned this Mar 4, 2024
tltv added a commit that referenced this issue Mar 4, 2024
Adds vitePluginFileSystemRouter to Vite plugins by default when React and Hilla is in use.

Fixes: #18832
mshabarov pushed a commit that referenced this issue Mar 4, 2024
* feat: add file system router plugin for vite

Adds vitePluginFileSystemRouter to Vite plugins by default when React and Hilla is in use.

Fixes: #18832

* chore: removed dep from default vite packages

Hilla packages adds the dep in dependencies already.

* test: added tests
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

4 participants