How to prevent unused code from being excluded from a bundle?

I have an old project on Laravel with jquery code, I’m trying to transfer it to Vite.
I have a file auth.js with code:

let auth;
$(function () {
    console.log('123');
    auth = {
        email: null, password: null, logIn: function () {
            $(".btn-login").off('click');
....

I use this function in blade template like this:

<script>
        $(document).ready(function () {
            auth.signUp();
            cabinet.showPassword();
        });
    </script>

My webpack config in old project:

const { mix } = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js');
mix.babel(['resources/assets/js/Auth.js','resources/assets/js/Billing.js'], 'public/js/scripts.js');

and it works well.

my vite config:

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/css/app.css',
                'resources/js/app.js',
                'resources/js/Auth.js',
            ],
            refresh: true,
        })
]})

after build, I have this in Auth.js:

$(function(){console.log("123")});

how can i build my js code and call these functions from blade templates?

P.S I know about the method with the window, but maybe there is a more correct way?

window.auth = {
   email: null, password: null, logIn: function () {