Hi,
How to require local utilities in my acpScript properly? I want to separate functions in my acpScript of my plugin into several JS files. My acpScipt is located at path public/lib/admin/index.js with codes:
'use strict';
/* globals socket, define, require */
define(
'admin/plugins/myPlugin',
[ 'myAdminUtilities' ],
function (util) {
const Admin = {};
Admin.init = function () {
socket.emit(
'plugins.myPlugin.getData',
myAdminUtilities.handleResponse,
);
};
return Admin;
}
);
Then, file myAdminUtilities is located at path public/lib/admin/utils.js with codes:
define('admin/plugins/myAdminUtilities', function () {
const adminUtils = {};
adminUtils.handleResponse = function (error, data) {
// process data ...
};
return adminUtils;
});
Also, I have modified my plugin.json with following:
{
...
"modules": {
"myAdminUtilities": "public/lib/admin/utils.js"
},
...
}
But, I get get admin/plugins/myAdminUtilities (404 Not found) every time I enter my plugin ACP page. What's the proper way to reach my goal?