Magento – mixin is not a function

magento2.2mixins

Hi I have created a mixin but it gives the error "mixin is not a function".

Vendor/CustomCustomer/view/base/web/customercustom.js

define([
    'jquery',
    'underscore',
    'uiRegistry',
    'Magento_Ui/js/form/element/select',
    'domReady!'
], function ($,_, uiRegistry, Select) {
    'use strict';
    $(function() {
    return function (Select) {
        return Select.extend({
            initialize: function (value) {
                this._super();
                var customerCompany = uiRegistry.get('index = customer_company');
                var defaultCompany = uiRegistry.get('index = extension_attributes.company_attributes.company_id');
                var vessels = uiRegistry.get('index = customer_vessels');
                var customerUsername = uiRegistry.get('index = customer_username');
                var password = uiRegistry.get('index = password');
                var cnfpassword = uiRegistry.get('index = confirm_password');
                if (this.value() != 1) {
                    customerCompany.show();
                    defaultCompany.hide();
                    vessels.show();
                    customerUsername.show();
                    password.show();
                    cnfpassword.show();
                } else {
                    customerCompany.hide();
                    defaultCompany.show();
                    vessels.hide();
                    customerUsername.hide();
                    password.hide();
                    cnfpassword.hide();
                }                
                return this;
            },
            onUpdate: function (value) {
                var customerCompany = uiRegistry.get('index = customer_company');
                var defaultCompany = uiRegistry.get('index = extension_attributes.company_attributes.company_id');
                var vessels = uiRegistry.get('index = customer_vessels');
                var customerUsername = uiRegistry.get('index = customer_username');
                var password = uiRegistry.get('index = password');
                var cnfpassword = uiRegistry.get('index = confirm_password');
                if (value != 1) {
                    customerCompany.show();
                    defaultCompany.hide();
                    customerUsername.show();
                    password.show();
                    cnfpassword.show();
                } else {
                    customerCompany.hide();
                    defaultCompany.show();
                    customerUsername.hide();
                    password.hide();
                    cnfpassword.hide();
                    vessels.hide();
                }

                return this._super();
            },
        });
    }
});
  });

Vendor/CustomCustomer/view/base/requirejs-config.js

var config = {
    'config': {
        'mixins': {
            'Magento_Ui/js/form/element/website': {
                'Vendor_CustomCustomer/customercustom': true
            }
        }
    }
};

Best Answer

You probably need to check and change the location of your mixin.
Refer to the documentation

Update: Remove single quotes in your mixins declaration:
reference

var config = {
    config: {
        mixins: {
            'Magento_Ui/js/form/element/website': {
                'Vendor_CustomCustomer/customercustom': true
            }
        }
    }
};
Related Topic