-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Extra <script> block in index.html gets deleted when compiled. How to Retain? #719
Comments
You can't use node api ( |
@Akiyamka, this is supposed to be used within electron when built. |
Can you have a try with code #724 and add <script type="retain"> // add type
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> |
Thank you @underfin and yes, it can be built with electron. |
same question, looking for resolving .... |
Same issue here with a simple Google Analytics script… :/ |
@cliqer Can you detailed explain the expected behavior and give a reproduction for this? |
@underfin I believe the script should stay in the file without being compiled or removed…? |
do you mean that, how to replace |
I'd say so, that makes sense that if we have an inline script tag in the HTML that should stay there. |
@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. |
Can you move the script to a file under public/bytenode-compile.js, and fetch it with
in the index.html? At least that works with a node-compiled service worker, that has to be compiled after rollup has finished. |
This doesn't seem to fix the issue, at least not on my side. That would be good to be able to do that, any progress on this? It's quite crucial for Analytics. |
@cliqer any solution to resolve this problem? i have the same prolem on my electron app, i almost finish the code , but dead when build the app orz... |
@wongwithhisfellowpartners I still have not found a solution for this. |
@cliqer did you occur some problem like |
If I add extra script within
index.html
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?vite
version: vite v1.0.0-rc.4vue
version (from `yarn.lock``) ^3.0.0-rc.5@vue/compiler-sfc
version ^3.0.0-rc.5The text was updated successfully, but these errors were encountered: