Inconsistent behavior for <script> tags in livewire components #10017
-
Livewire version4.1.4 Laravel version12.51.0 Which PHP version are you using?PHP 8.2 What is the problem?<script> tags inside of livewire component not wrapped in @script/@endscript work locally on mac with herd, but when deployed to ubuntu environment fail with a "Livewire only supports one HTML element per component. Multiple root elements detected for component: XXXX" error ### Code snippets ```blade
<script>
alert('test')
</script>?
```
How do you expect it to work?Should be consistent across platforms Please confirm (incomplete submissions will not be addressed)
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
@dorgan thanks for reporting this! I suspect this is caused by differences in the libxml2 library version between your two environments. Livewire uses Could you check the following on both your macOS and Ubuntu environments and paste the results here? PHP and libxml2 versions: php -r "echo 'PHP: ' . PHP_VERSION . PHP_EOL . 'libxml2: ' . LIBXML_DOTTED_VERSION . PHP_EOL;"Also, is Finally, could you share the actual component template that's triggering the error? Your example shows the |
Beta Was this translation helpful? Give feedback.
-
|
@dorgan thanks for confirming! That libxml2 difference is likely the cause (2.15 vs 2.9). I've submitted PR #10055 with a fix. In the meantime, setting |
Beta Was this translation helpful? Give feedback.
@dorgan thanks for confirming! That libxml2 difference is likely the cause (2.15 vs 2.9). I've submitted PR #10055 with a fix.
In the meantime, setting
APP_DEBUG=falseon your Ubuntu environment will avoid the error.