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

inline script not working with strict optimization during development #413

Closed
1 of 5 tasks
thescientist13 opened this issue Aug 12, 2020 · 1 comment
Closed
1 of 5 tasks
Assignees
Labels
bug Something isn't working CLI v0.10.0
Milestone

Comments

@thescientist13
Copy link
Member

Type of Change

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

Summary

As introduced as part of #354 , **strict ** optimization setting eliminates all bundled JavaScript from getting shipped to the browser when set, however, the example provided in the How It Works section is throwing an error in development mode and not working.

<script>
  function inlineScript() {
    alert('inline script running even in SSG mode, loading no external JS! 🎉');
  }
</script>
<eve-banner></eve-banner>
<button onclick="inlineScript()">For a good time, click here.</button>

<div class='gwd-content-wrapper'>
  <eve-container fluid>
    <div class='gwd-page-template gwd-content'>
      <entry></entry>
    </div>
  </eve-container>
</div>

However, it appears that this won't work in development mode, as in the case below, the function will be
Screen Shot 2020-08-11 at 8 33 54 PM

Details

I guess because all the JS is in memory and not serialized into the page? Though it's there from what I can see in the Elements tab.

Screen Shot 2020-08-11 at 8 36 12 PM

Maybe needs to be some sort of global function at the app or index.html level? Outside of a render?

@thescientist13
Copy link
Member Author

is not reproducible, as we are using this now for the shelf

@thescientist13 thescientist13 mentioned this issue Apr 4, 2021
12 tasks
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 v0.10.0
Projects
None yet
Development

No branches or pull requests

1 participant