Create-react-app: Code splitting and preventing duplication

Created on 9 Jan 2018  路  3Comments  路  Source: facebook/create-react-app

Is this a bug report?

Not a bug but, looking for some clarification

Which terms did you search for in User Guide?

Code Splitting, CommonsChunkPlugin, bundle-buddy


The user guide has a section on code splitting that focuses on dynamic import. However, I don't see any info on preventing duplication.

The webpack code splitting guide and bundle-buddy recommend using CommonsChunkPlugin to prevent code duplication across multiple chunks. However, it seems that CRA is not using CommonsChunkPlugin. Is the duplication being prevented via some other mechanism? If not, would you be open to a PR that adds CommonsChunkPlugin to webpack.config.prod.js.

Thanks!

proposal

Most helpful comment

Hehe.

I had no idea about this but it's probably what we want: https://github.com/webpack/webpack/pull/6281

All 3 comments

Related: https://github.com/facebookincubator/create-react-app/pull/3145 https://github.com/facebookincubator/create-react-app/pull/2310

I honestly don't know what's the right way to do it these days. We might need someone from webpack to help us with determining the right approach.

Hehe.

I had no idea about this but it's probably what we want: https://github.com/webpack/webpack/pull/6281

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stopachka picture stopachka  路  3Comments

DaveLindberg picture DaveLindberg  路  3Comments

fson picture fson  路  3Comments

oltsa picture oltsa  路  3Comments

barcher picture barcher  路  3Comments