html-template icon indicating copy to clipboard operation
html-template copied to clipboard

[BUG] Babel deoptimisation error

Open roman-supy-io opened this issue 9 months ago • 4 comments

Describe the bug.

Generator - latest Template - latest

[BABEL] Note: The code generator has deoptimised the styling of /Users/roman/Code/GitHub/**********/node_modules/@asyncapi/html-template/template/js/asyncapi-ui.min.js as it exceeds the max of 500KB

Expected behavior

Warning is not reported to the console or there's way to turn it off

Screenshots

Image

How to Reproduce

  1. Install latest generator and html-template
  2. run asyncapi generator generate command with html-template
  3. Observe the output

🖥️ Device Information [optional]

  • Operating System (OS): MacOS
  • Browser: -
  • Browser Version: -

👀 Have you checked for similar open issues?

  • [x] I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

roman-supy-io avatar Mar 21 '25 10:03 roman-supy-io

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

github-actions[bot] avatar Mar 21 '25 10:03 github-actions[bot]

Hey, thanks for the issue. I see you are open to work on a PR. Do you have some solution in mind already?

derberg avatar Mar 21 '25 12:03 derberg

@derberg I can do that but i need some guidance

roman-supy-io avatar Mar 24 '25 11:03 roman-supy-io

sure, what do you need?

derberg avatar Mar 24 '25 20:03 derberg

Hi, i have a same warining. In version 3.3.0 my command generate a wrong .html file but i execute with version 3.2.1 and works fine!

command(works): npx -p @asyncapi/cli asyncapi generate fromTemplate XXXXX.yml @asyncapi/[email protected] --output ./docs --use-new-generator --force-write command(not generate html correctly): npx -p @asyncapi/cli asyncapi generate fromTemplate XXXXX.yml @asyncapi/[email protected] --output ./docs --use-new-generator --force-write

npx -p @asyncapi/cli asyncapi --version @asyncapi/cli/3.1.1 darwin-arm64 node-v22.14.0

VictorRequenaMaisa avatar Jun 02 '25 17:06 VictorRequenaMaisa

@derberg i am exploring this issue

AayushSaini101 avatar Jun 03 '25 13:06 AayushSaini101

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] avatar Oct 02 '25 00:10 github-actions[bot]

Hi @derberg , @AayushSaini101 , I found the root cause of the Babel de-optimisation warning, it comes from generator-react-sdk, because asyncapi-ui.min.js (500KB+) gets passed into Rollup/Babel

The fix is simply to filter that file before transpiling

Update in the transpiler:

let { files, dirs } = await getStatsInDir(directory);
files = files.filter(f => !f.endsWith("asyncapi-ui.min.js"));

(or the stricter !f.includes(...) version)

Since https://github.com/asyncapi-archived-repos/generator-react-sdk is archived, the correct place to patch is:

asyncapi/generator repo

After patching, the generator runs clean:

┌  AsyncAPI Generator
Generation in progress. Keep calm and wait a bit
(node:10320) [DEP0030] DeprecationWarning: SlowBuffer() is deprecated. Please use Buffer.allocUnsafeSlow()
(Use `node --trace-deprecation ...` to show where the warning was created)
Check out your shiny new generated files at dupa.

No more Babel warning.

I'm opening an issue + PR on the generator repo for this.

lightning-sagar avatar Nov 28 '25 11:11 lightning-sagar

Hey maintainers, I need a bit of advice. For now I have fixed the Babel deoptimisation warning, so that part is clean now... However, I still see this Node.js warning during generation:

(node:19216) [DEP0030] DeprecationWarning: SlowBuffer() is deprecated. Please use Buffer.allocUnsafeSlow()
(Use `node --trace-deprecation ...` to show where the warning was created)

This comes from a dependency inside the generator (not the template) Should we also hide/suppress this warning, or is it better to leave it visible for now??

lightning-sagar avatar Dec 02 '25 18:12 lightning-sagar