issue when compiling with vite

150 Views Asked by At

I am using Vite in my laravel project, when I run the command npm run build all of the files are compiled and built in the build directory. my problem is that some of my functions in JS files will be removed during the compiling with vite because they are not used directly in that js file. but these functions are used by elements that will be created by js, so how can I solve this annoying problem?

I've used these codes in vite.config:

 rollupOptions: {
            output: {
                // Add the names of the functions or variables you want to keep
                // separated by commas
                keepAlive: ['changingData']
            }
        }

or

minify: false

but I can't fix it

0

There are 0 best solutions below