mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 01:33:08 +02:00
upd: make the mod tracker work in dev mode
this is an ugly hack but it's a ugly hack that works.
This commit is contained in:
parent
8702c1dd24
commit
f58f0eaf92
3 changed files with 10 additions and 1 deletions
1
packages/frontend/@types/global.d.ts
vendored
1
packages/frontend/@types/global.d.ts
vendored
|
@ -16,3 +16,4 @@ declare const _DATA_TRANSFER_DECK_COLUMN_: string;
|
|||
|
||||
// for dev-mode
|
||||
declare const _LANGS_FULL_: string[][];
|
||||
declare const __DIRNAME__: string;
|
||||
|
|
|
@ -233,7 +233,14 @@ export class ChiptuneJsPlayer {
|
|||
async createLibopenmptNode(buffer: ArrayBuffer) {
|
||||
if (!this.libopenmpt) {
|
||||
const libopenmpt = await import('libopenmpt-wasm');
|
||||
this.libopenmpt = await libopenmpt.default();
|
||||
this.libopenmpt = await libopenmpt.default( _DEV_ ? {
|
||||
// hack to make libopenmpt load in dev mode
|
||||
locateFile(file) {
|
||||
const url = new URL(window.location.href);
|
||||
url.pathname = `/@fs/${__DIRNAME__}/node_modules/libopenmpt-wasm/${file}`;
|
||||
return url.href;
|
||||
},
|
||||
} : {});
|
||||
}
|
||||
|
||||
return new ChiptuneProcessorNode(this, buffer);
|
||||
|
|
|
@ -55,6 +55,7 @@ const devConfig = {
|
|||
define: {
|
||||
...defaultConfig.define,
|
||||
_LANGS_FULL_: JSON.stringify(Object.entries(locales)),
|
||||
__DIRNAME__: JSON.stringify(__dirname),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue