I am adding storybooks to our project and to build it Vite requires the file vite.generated.ts to be there. I was trying multiple Gradle goals here to generate that file, but apparently it is only generated when I run the development mode. Even when I compile with the production command it does not generate it.
I don’t think you can commit it because it also depends on generated files in the build folder.
I see on top of the file the following comment:
[11:25] Thiago Vidigal
/**
* 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
*/
But when I run the gradle equivalent ./gradlew vaadinPrepareFrontend it does not get generated.
I have exactly the same problem, and just committing the “vite.generated.ts” doesn’t solve the problem because it references some files from the “build” folder. In this case, I would need to commit them as well, which is already too much.
The only way I found to generate that code is to run an application, but that’s not an option in a build pipeline.
Here are my errors:
✘ [ERROR] Could not resolve "./build/plugins/application-theme-plugin/theme-handle.js"
vite.generated.ts:12:38:
12 │ import { processThemeResources } from './build/plugins/application-theme-plugin/theme-handle.js'; ╵
✘ [ERROR] Could not resolve "./build/plugins/theme-loader/theme-loader-utils.js"
vite.generated.ts:13:31:
13 │ import { rewriteCssUrls } from './build/plugins/theme-loader/theme-loader-utils.js';
✘ [ERROR] Could not resolve "./build/plugins/rollup-plugin-postcss-lit-custom/rollup-plugin-postcss-lit.js"
vite.generated.ts:31:23:
31 │ import postcssLit from './build/plugins/rollup-plugin-postcss-lit-custom/rollup-plugin-postcss-lit.js';