How to use vite build to use another config file instead of vite.config.js
P粉162773626
2023-08-27 11:00:58
<p><code>vite build</code> uses <code>vite.config.js</code> to build the bundle if I have a <code>my.config.js</code> what to do? I can tell <code>vite build</code> to run this config instead of <code>vite.config.js</code></p>
Try this
1. If you want Vite to use a file named my.config.js instead of the default vite.config.js
Your my.config.js file is located in the root directory of your project.
2. Open a terminal or command prompt and navigate to the root directory of your project.
3. Use the --config flagRun the vite build command to specify the path to the custom configuration file.
4. This command tells Vite to use my.config.js as the configuration file for the build process
You can provide custom configuration files to Vite and override the default behavior using vite.config.js.