Skip to content

Commit

Permalink
shell: fix bundle not being fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
takase1121 committed May 11, 2024
1 parent b57b9cb commit cc84640
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ main() {
fi

# create data bundle
# sidenote: the file extension is set to wasm to trick reverse proxies to compress it
file_packager bundle.wasm --preload lite-xl/data@/usr/share/lite-xl \
# sidenote: the file extension is set to json to trick reverse proxies to compress it
file_packager bundle.json --preload lite-xl/data@/usr/share/lite-xl \
--preload "$rootdir/welcome.md@/usr/share/lite-xl/welcome.md" \
--js-output=bundle.wasm.js --use-preload-cache --no-node --no-force \
--js-output=bundle.json.js --use-preload-cache --no-node --no-force \
--use-preload-plugins --quiet

popd
Expand All @@ -277,7 +277,7 @@ main() {
# copy all the files
cp -r "$rootdir/shell/dist/." "$output"
cp "$xldir/lite-xl/lite-xl.js" "$xldir/lite-xl/lite-xl.wasm" "$output/js"
cp "$xldir/bundle.wasm.js" "$xldir/bundle.wasm" "$output/js"
cp "$xldir/bundle.json.js" "$xldir/bundle.json" "$output/js"
}

main "$@"
2 changes: 1 addition & 1 deletion shell/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<link rel="stylesheet" href="./css/main.css" />
<script src="./js/main.js"></script>
<script src="./js/bundle.wasm.js"></script>
<script src="./js/bundle.json.js"></script>
<script src="./js/lite-xl.js"></script>
</head>

Expand Down
1 change: 1 addition & 0 deletions shell/js/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Module.onRuntimeInitialized = () => {
runtimeReady = true;
start();
};
Module.locateFile = (name, prefix) => prefix + (name.endsWith(".json") ? "js/" + name : name);

// attach canvas to module
window.onload = () => {
Expand Down

0 comments on commit cc84640

Please sign in to comment.