question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extra <script> block in index.html gets deleted when compiled. How to Retain?

See original GitHub issue

If I add extra script within index.html <body> it gets deleted when compiled: How can I use the below code while having rollup rename main to main.hash.js / .jsc without deleting it when compiled?

  <script>
    const fs = require('fs');
    const bytenode = require('bytenode');
    if (!fs.existsSync('./_assets/main.jsc')) {
      bytenode.compileFile('./_assets/main.js', './_assets/main.jsc');
    }
    require('./_assets/main.jsc');
  </script>
  <!-- <script src="./_assets/main.jsc"></script> -->
  • vite version: vite v1.0.0-rc.4
  • Operating System: Windows 10 Enterprise LTSC
  • Node version: v12.18.2
  • Optional:
    • yarn version: 1.22.4
    • Installed vue version (from `yarn.lock``) ^3.0.0-rc.5
    • Installed @vue/compiler-sfc version ^3.0.0-rc.5

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
cliqercommented, Sep 5, 2020

@cliqer Can you detailed explain the expected behaviour and give a reproduction for this?

@underfin my personal need is to add a script for bytenode that will be compiled with electron but it seems that controlling how this gets compiled is something also needed in multiple other occasions. There is nothing special to reproduce. Just add the above within index.html and compile.

0reactions
wongwithhisfellowpartnerscommented, Oct 16, 2020

@cliqer did you occur some problem like can not found module on your app that appeared when build the electron app with vite and rollup when use some dependence base on nodejs?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I add certain script tags inside <head> and <body ...
It implies you want to add static script tags to your template. If that's the case you just need to go into your...
Read more >
The Simplest Ways to Handle HTML Includes | CSS-Tricks
If you put that in a file called index.njk , you could process it with a simple Node script into index.html like this:...
Read more >
Advanced Compilation | Closure Compiler - Google Developers
Compilation with ADVANCED_OPTIMIZATIONS achieves extra compression by being more aggressive in the ways that it transforms code and renames ...
Read more >
Output Management - webpack
Setting up HtmlWebpackPlugin​​ If you open index. html in your code editor, you'll see that the HtmlWebpackPlugin has created an entirely new file...
Read more >
Chapter 1, Writing Your First JavaScript Program - O'Reilly
Still, JavaScript is more complex than either HTML or CSS, ... In many cases, you'll put the <script> tags in the page's <head>...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found