fix: repl package import on server
This commit is contained in:
parent
9c13f6bb53
commit
89c06046b5
3 changed files with 72 additions and 74 deletions
|
|
@ -1,8 +1 @@
|
|||
// nanostores use process.env which kills the browser build
|
||||
window.process = {
|
||||
env: {
|
||||
NODE_ENV: 'development',
|
||||
},
|
||||
};
|
||||
|
||||
export * from './repl-component.mjs';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { controls, evalScope } from '@strudel.cycles/core';
|
||||
import { registerSoundfonts } from '@strudel.cycles/soundfonts';
|
||||
import { registerSynthSounds, registerZZFXSounds, samples } from '@strudel.cycles/webaudio';
|
||||
import * as core from '@strudel.cycles/core';
|
||||
|
||||
|
|
@ -26,7 +25,11 @@ export async function prebake() {
|
|||
modulesLoading,
|
||||
registerSynthSounds(),
|
||||
registerZZFXSounds(),
|
||||
registerSoundfonts(),
|
||||
//registerSoundfonts(),
|
||||
// need dynamic import here, because importing @strudel.cycles/soundfonts fails on server:
|
||||
// => getting "window is not defined", as soon as "@strudel.cycles/soundfonts" is imported statically
|
||||
// seems to be a problem with soundfont2
|
||||
import('@strudel.cycles/soundfonts').then(({ registerSoundfonts }) => registerSoundfonts()),
|
||||
samples(`${ds}/tidal-drum-machines.json`),
|
||||
samples(`${ds}/piano.json`),
|
||||
samples(`${ds}/Dirt-Samples.json`),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ const parseAttribute = (name, value) => {
|
|||
return value;
|
||||
};
|
||||
// console.log('attributes', settingAttributes);
|
||||
class StrudelRepl extends HTMLElement {
|
||||
if (typeof HTMLElement !== 'undefined') {
|
||||
class StrudelRepl extends HTMLElement {
|
||||
static observedAttributes = ['code', ...settingAttributes];
|
||||
settings = initialSettings;
|
||||
editor = null;
|
||||
|
|
@ -106,6 +107,7 @@ class StrudelRepl extends HTMLElement {
|
|||
// onEvent('strudel-toggle-play', () => this.editor.toggle());
|
||||
}
|
||||
// Element functionality written in here
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define('strudel-editor', StrudelRepl);
|
||||
customElements.define('strudel-editor', StrudelRepl);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue