[BUG] Babel deoptimisation error
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
How to Reproduce
- Install latest generator and html-template
- run
asyncapi generator generatecommand with html-template - 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?
- [x] I have read the Contributing Guidelines
Are you willing to work on this issue ?
Yes I am willing to submit a PR!
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.
Hey, thanks for the issue. I see you are open to work on a PR. Do you have some solution in mind already?
@derberg I can do that but i need some guidance
sure, what do you need?
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
@derberg i am exploring this issue
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:
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:
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.
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??