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

[Vite] Use the same generated config pattern as with webpack #12115

Closed
Artur- opened this issue Oct 22, 2021 · 3 comments · Fixed by #12208
Closed

[Vite] Use the same generated config pattern as with webpack #12115

Artur- opened this issue Oct 22, 2021 · 3 comments · Fixed by #12208

Comments

@Artur-
Copy link
Member

Artur- commented Oct 22, 2021

There should be a vite.generated.ts which we always overwrite and then a vite.config.ts that is only generated if it does not exist.

@Artur- Artur- added this to To do in Frontend build optimization via automation Oct 22, 2021
@gilberto-torrezan gilberto-torrezan added enhancement vite Tickets related to vite support labels Oct 26, 2021
@Artur-
Copy link
Member Author

Artur- commented Oct 27, 2021

Maybe this would work

vite.generated.ts

/**
 * NOTICE: this is an auto-generated file
 *
 * This file has been generated by the `flow:prepare-frontend` maven goal.
 * This file will be overwritten on every run. Any custom changes should be made to vite.config.ts
 */

import { UserConfigExport } from 'vite';

...

export const vaadinConfig: UserConfigExport = {
   ...
};

vite.config.ts

import { defineConfig, UserConfigExport } from 'vite';
import { vaadinConfig } from './vite.generated';

// https://vitejs.dev/config/
const customConfig: UserConfigExport = {
};

export default defineConfig({ ...vaadinConfig, ...customConfig });

@Artur-
Copy link
Member Author

Artur- commented Oct 27, 2021

There is actually a mergeConfig exported by Vite that we probably should use

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with platform 22.0.0.beta2 and is also targeting the upcoming stable 22.0.0 version.

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

Successfully merging a pull request may close this issue.

3 participants