Many lodash functions give error in y custom WordPress plugin

I’m building a WordPress plugin using the WordPress Plugin Boilerplate and in the admin area I need to use the lodash function .startCase(). The problem is that in the console I get the error “.startCase() is not a function”. Lodash lib is correctly loaded and, as it is loaded as a dependency of my main script, is loaded before of my main script.
In effect, I can use some lodash function like _.isNumber() or _.isSymbol(), but a great number of the other functions give the same error: _.isNil(), _.camelCase(), _.startCase()…

I tried to load lodash both from a local script and from a CDN but the result remains the same.
I show you here how the scripts are enqueued:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> public function enqueue_scripts() {
$current_screen = get_current_screen();
if ( 'plugin_list' === $current_screen->post_type || 'instalist_page_instalist_settings' === $current_screen->id ) {
wp_enqueue_script( 'instalist_main_js', plugin_dir_url( __FILE__ ) . 'js/instalist-admin.js', array( 'jquery', 'jquery-form', $this->plugin_name . '_sweetalert-script', $this->plugin_name . '_lodash' ), $this->version, true );
wp_enqueue_script( $this->plugin_name . '_sweetalert-script', plugin_dir_url( __FILE__ ) . 'js/sweetalert2.min.js', array(), $this->version, false );
wp_enqueue_script( $this->plugin_name . '_lodash', 'https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js', array(), $this->version, false );
}
}
</code>
<code> public function enqueue_scripts() { $current_screen = get_current_screen(); if ( 'plugin_list' === $current_screen->post_type || 'instalist_page_instalist_settings' === $current_screen->id ) { wp_enqueue_script( 'instalist_main_js', plugin_dir_url( __FILE__ ) . 'js/instalist-admin.js', array( 'jquery', 'jquery-form', $this->plugin_name . '_sweetalert-script', $this->plugin_name . '_lodash' ), $this->version, true ); wp_enqueue_script( $this->plugin_name . '_sweetalert-script', plugin_dir_url( __FILE__ ) . 'js/sweetalert2.min.js', array(), $this->version, false ); wp_enqueue_script( $this->plugin_name . '_lodash', 'https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js', array(), $this->version, false ); } } </code>
    public function enqueue_scripts() {
        $current_screen = get_current_screen();
        if ( 'plugin_list' === $current_screen->post_type || 'instalist_page_instalist_settings' === $current_screen->id ) {
            wp_enqueue_script( 'instalist_main_js', plugin_dir_url( __FILE__ ) . 'js/instalist-admin.js', array( 'jquery', 'jquery-form', $this->plugin_name . '_sweetalert-script', $this->plugin_name . '_lodash' ), $this->version, true );
            wp_enqueue_script( $this->plugin_name . '_sweetalert-script', plugin_dir_url( __FILE__ ) . 'js/sweetalert2.min.js', array(), $this->version, false );
            wp_enqueue_script( $this->plugin_name . '_lodash', 'https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js', array(), $this->version, false );
        }
    }

btw, sweetalert works fine.

In my main script, I call the function this way:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>(function ($) {
"use strict";
$(document).ready(function () {
$("#plugin_slug").on("keyup", function () {
if ($(this).val().length === 0) {
$(this).sibling("#plugin_name").val("");
return;
}
if ($(this).val().length < 4) {
return;
}
$(this).siblings("#plugin_name").val(_.startCase($(this).val()));
$(this).siblings("#plugin_name").trigger("keyup");
});
});
});
</code>
<code>(function ($) { "use strict"; $(document).ready(function () { $("#plugin_slug").on("keyup", function () { if ($(this).val().length === 0) { $(this).sibling("#plugin_name").val(""); return; } if ($(this).val().length < 4) { return; } $(this).siblings("#plugin_name").val(_.startCase($(this).val())); $(this).siblings("#plugin_name").trigger("keyup"); }); }); }); </code>
(function ($) {
    "use strict";
    $(document).ready(function () {

        $("#plugin_slug").on("keyup", function () {
            if ($(this).val().length === 0) {
                $(this).sibling("#plugin_name").val("");
                return;
            }
            if ($(this).val().length < 4) {
                return;
            }
            $(this).siblings("#plugin_name").val(_.startCase($(this).val()));
            $(this).siblings("#plugin_name").trigger("keyup");
        });

        });
});

I’m on a local environment with WordPress 6.5.5 and the active theme is Twenty Twenty-four. The only 2 other plugins installed are Litespeed Cache and Plugin Check. Disabling these plugins doesn’t change anything.

I can’t guess what’s going wrong here. If you need more info; I’ll be glad to give you.
Thank you in advance for any suggestion.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật