Parcel: Code duplicated when using Dynamic Imports

Created on 11 Apr 2018  路  2Comments  路  Source: parcel-bundler/parcel

This a 馃悰 bug report.

Based on How it Works and issue #37 it seems as though this is a bug.

When splitting your code, if a common module is included in both the parent and child it is duplicated rather then shared.

馃帥 Configuration (.babelrc, package.json, cli command)

{
  "your": { "config": "here" }
}

馃 Expected Behavior

Common code is shared.

馃槸 Current Behavior

Common code is duplicated.

馃敠 Context

Increases the size of the bundle, could potentially cause problems in cases where something can't be defined multiple times. (i.e. web components)

馃捇 Code Sample

Just open up the console when you look at the demo.
You'll see that common.js is logged multiple times.

https://parcel-bundler-dynamic-dedupe.glitch.me _Edit_

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.7.0
| Node | v9.11.1
| Yarn | 1.5.1
| Operating System | MacOS High Sierra 10.13.3

Bug

Most helpful comment

Are there any updates/fixes for this?

I just switched over to Parcel from Webpack only to discover that all my Vendor code is also included in all bundles.

// Edit - Screenshot of my main & admin bundle: https://prnt.sc/jai2rc

All 2 comments

Are there any updates/fixes for this?

I just switched over to Parcel from Webpack only to discover that all my Vendor code is also included in all bundles.

// Edit - Screenshot of my main & admin bundle: https://prnt.sc/jai2rc

Currently common code is hoisted to the parent bundle, but that will change in Parcel 2. We will be creating a separate bundle that loads in parallel with the shared code. See #885.

Was this page helpful?
0 / 5 - 0 ratings