UNPKG

utquidem

Version:

The meta-framework suite designed from scratch for frontend-focused modern web development.

24 lines (20 loc) 642 B
import type { EsmpackPlugin } from '../Options'; import type { Compiler } from '../Compiler'; const pluginName = 'LodashPlugin'; class LodashPlugin implements EsmpackPlugin { apply(compiler: Compiler) { compiler.hooks.compilation.tap(pluginName, compilation => { const enable = compilation.specifier.includes('lodash'); if (enable) { const cwd = compiler.options.cwd; compilation.hooks.rollupPluginOptions.commonjs.tap( pluginName, commonjsOptions => { commonjsOptions.transformMixedEsModules = false; }, ); } }); } } export { LodashPlugin };