MTG / essentia.js

JavaScript library for music/audio analysis and processing powered by Essentia WebAssembly
https://essentia.upf.edu/essentiajs
GNU Affero General Public License v3.0
627 stars 41 forks source link

Can't import Essentia #128

Open bclark288 opened 11 months ago

bclark288 commented 11 months ago

What is the issue about?

What part(s) of Essentia.js is involved?

Description

I'm trying to use Essentia-WASM in a node / nestjs project. I've gotten everything to work ok using require('essentia.js'), but I would like to use the import statements demontrated in the "Getting started" Tutorial. import Essentia from './essentia.js-core.es.js'; // import essentia-wasm-module import { EssentiaWASM } from './essentia-wasm.es.js';

However, when I use these I get the following error: /audio-analysis/node_modules/essentia.js/dist/essentia-wasm.es.js:32 export { Module as EssentiaWASM }; ^^^^^^

SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:73:18) at wrapSafe (node:internal/modules/cjs/loader:1153:20) at Module._compile (node:internal/modules/cjs/loader:1197:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1287:10) at Module.load (node:internal/modules/cjs/loader:1091:32) at Function.Module._load (node:internal/modules/cjs/loader:938:12) at Module.require (node:internal/modules/cjs/loader:1115:19) at require (node:internal/modules/helpers:119:18) at Object. (/audio-analysis/src/app.controller.ts:6:1) at Module._compile (node:internal/modules/cjs/loader:1233:14)

...

Steps to reproduce / Code snippets / Screenshots

-

System info

i.e. Hardware, OS, platform (which browser / version of Node, etc), Essentia.js version... Essentia.js version 0.1.3