Open victor-wm opened 2 years ago
Is there something else in the toolchain doing this? More complicated example? Just wondering because I can't seem to reproduce this in the tests.
I believe dom expressions is doing the right thing but it hands a template literal without a cooked value to Babel which will try to transform the literals and fail.
I'm not sure how you would repro this in tests without adding the template literal plug-in to the transform chain. Maybe an end to end test.
@nksaraf keep me honest here, but I believe you chose template literals so you wouldn't need to safe encode the value, as uncook
would be doing that automatically?
I think that might have been the reason.. I'm sorry I don't remember exactly..
This is a repro using only Babel. npm run build
will just output the babel code.
If you go to .babelrc
and remove the @babel/transform-template-literals
you will see the correct output. But if you keep it, you will see the empty string in the output.
So you would need a test that chains the template literal plugin into the mix.
@ryansolid could repro in tests if you use the transform plugin:
This issue seems to be fixed, I tested the code provided in the zip and both versions output the desire text.
Summary
When using the
generate: 'universal'
mode of the babel plugin, templates in the form of<element>Static text</element>
will not produce the correct output, omitting the static text.Details
When examining the output of the
universal
renderer, the generated code for static text is not including the raw text passed as child to the elements. The expected output for<element>Static text</element>
would be similar to:but since 0.33.0 (reflected in babel-plugin-solid 1.3.6), the output I see is
Further investigation points to an issue with babel that won't produce the right output, and that matches the input
dom-expressions
started to give in 0.33.0: https://github.com/babel/babel/issues/14682, more specifically:A workaround would be to revert that transform to use
stringLiteral
with thehtmlentities
decoding as previously done.