0

my app.js file:

import './bootstrap';
import jQuery from 'jquery';
window.$ = jQuery;
import './tom-select.complete';

app.css:

@import 'tom-select.bootstrap4.css';
@tailwind base;
@tailwind components;
@tailwind utilities;

vite.config.js:

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

And the script in my blade file:

@script()
<script>

    $(document).ready(function() {
        var settings = {
            plugins: ['remove_button','dropdown_input'],
        };
        var select = new TomSelect('#mySelect', settings);

        $('#mySelect').on('change', function(e) {
            $wire.selectedManagers = $(this).val();
        });
    });
</script>
@endscript

When I use this configuration in my local environment with npm run dev it works, but when i try to deploy it in my server i can buold without problems with npm run build, but I got this error:

jQuery.Deferred exception: TomSelect is not defined ReferenceError: TomSelect is not defined at HTMLDocument.eval (eval at safeAsyncFunction (

0

Browse other questions tagged or ask your own question.