Closed BenSapiens closed 6 years ago
Just create a third file where you import both js files and import that one into your HTML with a script tag. That should produce the desired result
in your scenario, the duplicated JS module does not have a common JS ancestor since it comes from two different HTML entries. therefore, we cannot hoist it up and dedup it. I believe this is working as designed.
Thanks for the reply. I think the problems I'm having with Parcel are my own fault. It seems to rely on a large number of implicit assumptions of which I have no direct knowledge. I'll spend a lot more time trying to figure them out. Great work overall.
π bug report
So maybe I'm just retarded, but your bundler isn't actually deduplicating included assets.
π Configuration (.babelrc, package.json, cli command)
Steps to reproduce:
import TweenMax from "gsap";
in both Javascript files. (or react, or any other)π€ Expected Behavior
As stated here, "If an asset is required in more than one bundle, it is hoisted up to the nearest common ancestor in the bundle tree so it is not included more than once."
One of the resulting Javascript files should contain the TweenMax library and one shouldn't... right?
π― Current Behavior
As it is, each imported library is built into each Javascript file. It will be downloaded again and again and again... every time anyone goes to a new page.
π Possible Solution
...I don't know, man.
π¦ Context
I'm just trying to use the spiffiest new build tool around.
π» Code Sample
dist.tar.gz src.tar.gz
π Your Environment