const init = (params) => { console.log('moduleB init'); return { name: 'moduleB', functionName: params.type, otherParams: { id: `xxxx${params.type}`, age: `xxxx${params.type}`, }, }; }; const getData = (params) => { console.log('moduleB getData'); return { name: 'moduleB', functionName: params.type, otherParams: { id: `xxxx${params.type}`, age: `xxxx${params.type}`, }, }; }; export default function (params) { // console.log('moduleB'); // console.log(params); return eval(params.type + '(params)'); }