Hello I am using the jQuery UI accordion on a website with wordpress and I get the error: “Uncaught TypeError: $(…).accordion is not a function”

In my functions.php I load a app.js, where I have bundled the jQuery UI file and other jQuery plugins, with this function: wp_enqueue_script( ‘theme-js’, get_template_directory_uri() . ‘/js/app.js’, array(‘jquery’), null, true );

To bundle the app.js file I use webpack.

This is how i include jQuery UI in my main.js in webpack:

var $ = window.jQuery;
var jqueryUi = require("./jquery-ui.min.js");

I already disabled all plugins on my wordpress installation and deleted othe jQuery plugins.

Thank you.

Read more here: Uncaught TypeError: $(…).accordion is not a function in wordpress


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: