-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
Trying to use this in sveltekit and getting the following error:
SyntaxError: Named export 'PianoRollSVGVisualizer' not found. The requested module '@magenta/music/esm/core.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@magenta/music/esm/core.js';
const { urlToNoteSequence, PianoRollSVGVisualizer, WaterfallSVGVisualizer, StaffSVGVisualizer, Player, SoundFontPlayer } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:121:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:171:5)
at async Loader.import (node:internal/modules/esm/loader:178:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at async nodeImport (/Users/rchrdnsh/Code/Svelte/RYKR-kit/node_modules/vite/dist/node/chunks/dep-e1fc1d62.js:59463:21)
at async eval (/src/routes/midi-player.svelte:7:31)
at async instantiateModule (/Users/rchrdnsh/Code/Svelte/RYKR-kit/node_modules/vite/dist/node/chunks/dep-e1fc1d62.js:59393:9)
Named export 'PianoRollSVGVisualizer' not found. The requested module '@magenta/music/esm/core.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@magenta/music/esm/core.js';
const { urlToNoteSequence, PianoRollSVGVisualizer, WaterfallSVGVisualizer, StaffSVGVisualizer, Player, SoundFontPlayer } = pkg;
file:///Users/rchrdnsh/Code/Svelte/RYKR-kit/node_modules/html-midi-player/dist/esm/index.js:8
import { urlToNoteSequence, PianoRollSVGVisualizer, WaterfallSVGVisualizer, StaffSVGVisualizer, Player, SoundFontPlayer } from '@magenta/music/esm/core.js';
^^^^^^^^^^^^^^^^^^^^^^...I'm a bit unsure as to what to do to make it work, or what to change where...any thoughts would be appreciated...
SvelteKit uses Vite which uses ES Build under the hood and is essentially ESM only, if that helps...
Metadata
Metadata
Assignees
Labels
No labels