hermes icon indicating copy to clipboard operation
hermes copied to clipboard

babel-plugin-syntax-hermes-parser drops chunk names

Open ayroblu opened this issue 1 year ago • 2 comments

Bug Description

In our babel config, we define:

...
plugins: [
  'babel-plugin-syntax-hermes-parser',
  ...
]
...

We also have this in our webpack build:

...
splitChunks: {
  cacheGroups: {
    shared: {
      name: (module, chunks, cacheGroupKey) => {
        return `${cacheGroupKey}~${chunks
          .map((chunk) => chunk.name)
          .join('~')}`.slice(0, 109);
      },
      ...
    },
    ...
  },
  ...
}

If I add a log on the names generated, BEFORE: shared~chunkname~otherchunkname AFTER: shared~~.

The only change I'm making to our codebase is to add the plugin to the babel.config.js

The parser should not drop chunk names

ayroblu avatar Feb 22 '24 14:02 ayroblu

I figured out the basic issue, which is that the babel parser preserves comments, but the hermes parser doesn't

import( /* webpackChunkName: 'chunk.name' */ "./file");
import("./file")

ayroblu avatar Apr 11 '24 07:04 ayroblu

Hello,

just hit the exact same issue :)

pascalduez avatar Jul 29 '24 15:07 pascalduez