1
在webpack捆绑的模块中使用libs如lodash的最佳实践是什么?如何在webpack模块中正确使用库
1. 它需要一个全局变量
window._ = require('lodash');
2. 的WebPack的conf
new webpack.ProvidePlugin({ _: 'lodash' });
3. 需要它的模块中,如果我想要一个模块就像使用lodash
let _ = require('lodash');
或
个import _ from lodash;
4. 只导入功能,我想在当前模块中使用来自lodash像
import { find, map } from 'lodash';