Skip to content

How to make it work on vite #618

Open
@chan15

Description

@chan15

Description:

I used vite as the pack tool, there is my vite config below:

vite.config.js

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import inject from "@rollup/plugin-inject";
import requireTransform from 'vite-plugin-require-transform';

export default defineConfig({
    plugins: [
        requireTransform({
            fileRegex: /.(js|jsx|ts|tsx)$/,
        }),
        inject({
            $: 'jquery',
            jQuery: 'jquery',
        }),
        laravel({
            input: [
                'resources/css/chan.scss',
                'resources/js/app.js',
            ],
            refresh: true,
        }),
    ],
});

app.js

import "jquery-validation";
import "jquery.cookie";
import "jquery-form";

$(function() {
    $('#frm').validate();
    $('#frm').ajaxForm({
        success: function(response) {
            console.log(response);
        }
    });
});

I got TypeError: Ge(...).ajaxForm is not a function, other old jquery plugins works perfectly, need your help to solve this issue, thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions