Vite production build for vaadin 24 flow (with some custom js components) not respecting my config

71 views Asked by At

i am trying to run a vaadin 24 production build after migration from vaadin 14. When i changed vaadin version from 14.8.7 to 24.3.3 I deleted package-lock.json, webpack.config.js (cuz vaadin 24 uses Vite) and the target folder then i ran a build. Build succeeded, the app started, but when i went to the browser exception appared saying "Unable to find index.html. It should be available on the classpath when running in production mode".

I would love to tell Vite where to put the bundled files and I have tried adding vite.config.ts but it seems like it is not using my config:

import { UserConfigFn } from 'vite';
import { overrideVaadinConfig } from './vite.generated';

const customConfig: UserConfigFn = (env) => ({
  root: 'frontend',
  build: {
    outDir: '../../target/frontend',
    assetsDir: 'frontend',
    minify: 'terser',
    cssCodeSplit: true
    },
});

export default overrideVaadinConfig(customConfig);

I want Vite to take files from frontend folder and the generated bundles to go to target/frontend.

How to make Vaadin respect my vite.config.ts? Is my config file ok?

0

There are 0 answers