metro-code-split icon indicating copy to clipboard operation
metro-code-split copied to clipboard

Ability to name chunks

Open hamdiwanis opened this issue 4 years ago • 2 comments

First of all thanks for the great lib.

I was wondering if there is a way to name chunks the same way webpack do?

hamdiwanis avatar Oct 13 '21 08:10 hamdiwanis

First of all, thank you for asking

At present, there is no configuration or support for this function, and it will not be supported in the short term (sorry to be a little busy), but the implementation is not very complicated, welcome PR.

Some feasible technical implementation schemes:

  1. Obtain the name of the annotation or directly use the name of the loading chunk 1.1 get the comment name: metor customSerializer graph reference:graph.dependencies.get('xxx').getSource() 1.2 or directly use the name of the chunk to load: Reference val.modules https://github.com/wuba/metro-code-split/blob/f5ac4587d4cd7e0c77870e297ea22c46a61bb6ac/src/config/dynamicImports.js#L117

  2. Export chunk: reference https://github.com/wuba/metro-code-split/blob/f5ac4587d4cd7e0c77870e297ea22c46a61bb6ac/src/config/dynamicImports.js#L127

  3. Make sure chunk loads as scheduled: 3.1 the reference https://github.com/wuba/metro-code-split/blob/f5ac4587d4cd7e0c77870e297ea22c46a61bb6ac/src/tpl/wrapAsyncRequire.ejs#L32 3.2 or use asyncRequireTpl for customization https://github.com/wuba/metro-code-split/blob/f5ac4587d4cd7e0c77870e297ea22c46a61bb6ac/src/index.js#L35

zq0904 avatar Nov 08 '21 08:11 zq0904

hi , thanks for the greate lib, please how to rename/special output dll/buz bundle name?, such as common.android.bundle, business-a.android.bundle @zq0904

krmao avatar Sep 29 '22 03:09 krmao