Feature Request: embed .wasm file inside of vim.html so you have a single html file with everything. Like vim.html
ilse-langnar opened this issue · 0 comments
What is an issue which you want to solve with your feature request?
I want to have a single "vim.html" where everything is contained, even if it makes the file bigger. I already embedded the "VimWasm.js" inside a <script>.
So in this I only have to "import" the "vim.js" file like this:
const screenCanvasElement = document.getElementById('vim-screen');
const vim = new VimWasm({ // VimWasm is available in the global scope via window.VimWasm(loaded via <script>)
workerScriptPath: './node_modules/vim-wasm/small/vim.js',
canvas: screenCanvasElement,
input: document.getElementById('vim-input'),
});
The problem is that when you're inside of vim.js it uses fetch
to get the vim.wasm binary so you need a server running to have this working.
Describe the solution you'd like
The solutions would be that you can actually embed .wasm inside of a .html file via base64 encoding, this might not be the most good for performance but for portability it's great!( see https://stackoverflow.com/questions/52582367/a-single-file-webassembly-html-demo and https://gist.github.com/dio/ae79cf546e808a9bc46515bf9400ad5d)
I have tried edit the code myself but it uses both WebAssembly.instantiate
and WebAssembly.instantiateStreaming
so I'm not exactly sure what to do thus I'm opening this issue.