I was trying to use babel-plugin-lodash to get rid off the monolithic lodash.js module and instead get cherry-picked and tree-shaken individual lodash/* modules everywhere. While the babel plugin works, and indeed rewrites all the imports, I still end up having both the monolithic lodash.js as well as the individual modules:
I searched through the /dist output to see what is pulling this in, but there is nothing anymore depending on it. There is a d('lodash', ...) AMD shim in chunk.app.*.js, but no other define() that actually consumes this. Also putting a breakpoint in front of the actual module (the webpack emitted eval()) confirms that it is unused.
When looking at the output of BROCCOLI_DEBUG=ember-auto-import:preprocessor:* ember b, I see modules like these (some irrelevant ... parts omitted):
The original source has a import _ from 'lodash'; and somewhere else some _.cloneDeep() calls. So the babel plugin does its job obviously, but looking at that eaimeta... embedded serialization it seems eai still thinks that lodash is imported. First I thought it might be related to the execution order of babel plugins, but what puzzles me is that in that eaimeta...bothlodash/cloneDeep (which must come from babel-plugin-lodash) as well as lodash are present.
Also confusing to me is the fact that the tree passed to the Analyzer (by looking at the output of BROCCOLI_DEBUG=ember-auto-import:preprocessor:*) already contains those eaimeta..., as this is the input of the Analyzer here. But maybe I am misunderstanding something...
I was trying to use babel-plugin-lodash to get rid off the monolithic
lodash.js
module and instead get cherry-picked and tree-shaken individuallodash/*
modules everywhere. While the babel plugin works, and indeed rewrites all the imports, I still end up having both the monolithiclodash.js
as well as the individual modules:I searched through the
/dist
output to see what is pulling this in, but there is nothing anymore depending on it. There is ad('lodash', ...)
AMD shim inchunk.app.*.js
, but no otherdefine()
that actually consumes this. Also putting a breakpoint in front of the actual module (the webpack emittedeval()
) confirms that it is unused.When looking at the output of
BROCCOLI_DEBUG=ember-auto-import:preprocessor:* ember b
, I see modules like these (some irrelevant...
parts omitted):The original source has a
import _ from 'lodash';
and somewhere else some_.cloneDeep()
calls. So the babel plugin does its job obviously, but looking at thateaimeta...
embedded serialization it seems eai still thinks thatlodash
is imported. First I thought it might be related to the execution order of babel plugins, but what puzzles me is that in thateaimeta...
bothlodash/cloneDeep
(which must come from babel-plugin-lodash) as well aslodash
are present.Also confusing to me is the fact that the tree passed to the
Analyzer
(by looking at the output ofBROCCOLI_DEBUG=ember-auto-import:preprocessor:*
) already contains thoseeaimeta...
, as this is the input of the Analyzer here. But maybe I am misunderstanding something.../cc @NullVoxPopuli