Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple inline <script> tags not getting correctly optimized - all tags show the same contents #572

Closed
1 of 5 tasks
thescientist13 opened this issue Apr 25, 2021 · 0 comments · Fixed by #573
Closed
1 of 5 tasks
Assignees
Labels
bug Something isn't working CLI P0 Critical issue that should get addressed ASAP v0.11.1
Milestone

Comments

@thescientist13
Copy link
Member

thescientist13 commented Apr 25, 2021

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

Looks like there is a bug in our rollup.config.js logic that tries to optimize inline <script> tags. For example this

<script type="module">
const one = 'script tag module inline one';

document.getElementsByClassName('output-script-inline-one')[0].innerHTML = one;
</script>

<script type="module">
const two = 'script tag module inline two';

document.getElementsByClassName('output-script-inline-two')[0].innerHTML = two;
</script>

should come out like this

<script type="module">
document.getElementsByClassName('output-script-inline-one')[0].innerHTML = 'script tag module inline one';
</script>

<script type="module">
document.getElementsByClassName('output-script-inline-two')[0].innerHTML = 'script tag module inline two';
</script>

instead it is coming out with the second inlined version being the same code as the first inline <script> tag

<script type="module">
document.getElementsByClassName('output-script-inline-one')[0].innerHTML = 'script tag module inline one';
</script>

<script type="module">
document.getElementsByClassName('output-script-inline-one')[0].innerHTML = 'script tag module inline one';
</script>

Details

Not sure if the issue is related to poor hashing, so maybe a good case to finally tackle #553? While we're at, should confirm how this works

  1. With / without type="module"
  2. <style> tags
@thescientist13 thescientist13 added bug Something isn't working P0 Critical issue that should get addressed ASAP CLI labels Apr 25, 2021
@thescientist13 thescientist13 added this to the 1.0 milestone Apr 25, 2021
@thescientist13 thescientist13 self-assigned this Apr 25, 2021
@thescientist13 thescientist13 moved this from IN PROGRESS to IN REVIEW in 6 - Theme Packs and SSR R&D + ESM Upgrade Apr 25, 2021
@thescientist13 thescientist13 moved this from IN REVIEW to IN PROGRESS in 6 - Theme Packs and SSR R&D + ESM Upgrade Apr 25, 2021
@thescientist13 thescientist13 changed the title rollup configuration not correctly inlining multiple <script> tags (all tag tags show the same contents) multiple inline <script> tags not getting correctly optimized - all tag tags show the same contents Apr 25, 2021
@thescientist13 thescientist13 moved this from IN PROGRESS to IN REVIEW in 6 - Theme Packs and SSR R&D + ESM Upgrade Apr 26, 2021
@thescientist13 thescientist13 changed the title multiple inline <script> tags not getting correctly optimized - all tag tags show the same contents multiple inline <script> tags not getting correctly optimized - all tags show the same contents May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLI P0 Critical issue that should get addressed ASAP v0.11.1
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant