Builder content link
https://builder.io/content/01dd38ae10794d859c69f42341507b3f
Builder public api key
64dd5478e25746bf9db3b6c0319905f6
Bug description
Custom code components strip the custom code of all newlines. This causes problems. Here are some affected use cases relevant to me:
- JavaScript using standard
//style
comments. Because newlines are removed, everything after the double slash is registered as a comment. - Users are entirely unable to leverage the
{% liquid %}
tag from Shopify’s Liquid language, which (like Python) relies on newlines to distinguish different lines of code.
The issue can lead to frustrating debug sessions and hours of wasted time. I have been working around this since we started using Builder.io in early 2023. Now, I find that once again our ambitions are slowed by the issue. Please enable Custom code components to retain their newlines.
Detailed steps to reproduce the bug
Go to the editor, expand the “Code” section and add a Custom code
component to your page. Update the new component’s code to the following:
<script>
var builderTest = "BEFORE";
// simple comment
var builderTest = "AFTER";
</script>
Preview the page and open the dev console. Type builderTest
and press enter. You’ll see that the variable contains the value “BEFORE” when it should be “AFTER”.
Code stack you are integrating Builder with
React, Shopify