Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ayroblu opened this issue Feb 22, 2024 · 1 comment
Open

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

ayroblu opened this issue Feb 22, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@ayroblu
Copy link

ayroblu commented Feb 22, 2024

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 ayroblu added the bug Something isn't working label Feb 22, 2024
@pieterv pieterv self-assigned this Feb 29, 2024
@ayroblu
Copy link
Author

ayroblu commented Apr 11, 2024

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")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants