search

Home  >  Q&A  >  body text

How to use vite build to use another config file instead of vite.config.js

<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>
P粉162773626P粉162773626461 days ago552

reply all(1)I'll reply

  • P粉232409069

    P粉2324090692023-08-28 00:38:32

    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.

    vite build --config my.config.js

    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.

    reply
    0
  • Cancelreply