Can't import module due to ES6 syntax: "unexpected token export"

I’m trying to run unit tests on my app, but I keep getting an error:


[Error] There was a problem loading [/app/as-pect.config.js].
/rbd/pnpm-volume/ea5dbfa5-c117-4ea6-956c-a880b1a932b2/node_modules/.registry.npmjs.org/assemblyscript/0.19.0/node_modules/assemblyscript/lib/loader/index.js:318
export async function instantiate(source, imports = {}) {
^^^^^^

SyntaxError: Unexpected token export

Since it’s a 3rd party module, I can’t change how the module imports/exports so NodeJS v12.x can handle it.

Any suggestions? Thanks

Hiya humanman, welcome to the forum!

Not sure if this will work, but could you try adding

"type" : "module"

to your package.json?

Src: https://nodejs.org/api/esm.html#esm_enabling

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.