typescript - Provide lodash with mixins globally via webpack.ProvidePlugin -
i have lodash mixins want provide webpack.provideplugin, e.g:
import * _ 'lodash'; export {_}; _.mixin({ capitalize: function (input: string) { bla... } }) i'm using typescript webpack.
in webpack.config.js have:
lodashplugin = new webpack.provideplugin({ _: 'common/lodash_mixins' }) when try use _.capitalize(string),
typeerror: _.capitalize not function
when log '_' see capitalize in fact function on object.
what missing here?
you exporting _ named export, require import { _ } from 'common/lodash_mixins';, provideplugin expects export single object. should using default export instead.
export default _; see default export.
Comments
Post a Comment