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
|
@ -16,3 +16,4 @@ declare const _DATA_TRANSFER_DECK_COLUMN_: string;
|
||||||
|
|
||||||
// for dev-mode
|
// for dev-mode
|
||||||
declare const _LANGS_FULL_: string[][];
|
declare const _LANGS_FULL_: string[][];
|
||||||
|
declare const __DIRNAME__: string;
|
||||||
|
|
|
@ -233,7 +233,14 @@ export class ChiptuneJsPlayer {
|
||||||
async createLibopenmptNode(buffer: ArrayBuffer) {
|
async createLibopenmptNode(buffer: ArrayBuffer) {
|
||||||
if (!this.libopenmpt) {
|
if (!this.libopenmpt) {
|
||||||
const libopenmpt = await import('libopenmpt-wasm');
|
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);
|
return new ChiptuneProcessorNode(this, buffer);
|
||||||
|
|
|
@ -55,6 +55,7 @@ const devConfig = {
|
||||||
define: {
|
define: {
|
||||||
...defaultConfig.define,
|
...defaultConfig.define,
|
||||||
_LANGS_FULL_: JSON.stringify(Object.entries(locales)),
|
_LANGS_FULL_: JSON.stringify(Object.entries(locales)),
|
||||||
|
__DIRNAME__: JSON.stringify(__dirname),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue