-
Notifications
You must be signed in to change notification settings - Fork 584
Open
Description
现在需要手动一个个require,我自己改成了自动require,代码如下,亲测没问题。
/**
* @desc webpack打包入口文件
*/
let moduleExports = {};
const r = require.context('./', true, /^\.\/.+\/.+\.js$/);
r.keys().forEach(key => {
let attr = key.substring(key.lastIndexOf('/') + 1, key.lastIndexOf('.'));
moduleExports[attr] = r(key);
});
module.exports = moduleExports;