Search code examples
vue.jswebbundlervite

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


vite build uses the vite.config.js to build the bundle, what if I have a my.config.js, how can I tell vite build to run this config instead of vite.config.js


Solution

  • Try this

    1.If you have a file named my.config.js that you want Vite to use instead of the default vite.config.js

    your my.config.js file is located in the root directory of your project.

    2.Open your terminal or command prompt and navigate to the root directory of your project.

    3.Run the vite build command with the --config flag, specifying the path to your 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 a custom configuration file to Vite and override the default behavior of using vite.config.js.