commonjs – importing theatre js in vite
so I am trying to add theatre js and three js to my existing svelte project (with vite).
according to the documentation (www.theatrejs.com/docs/0.5/getting-started/with-three-js) I should be able to do this
import { getProject } from '@theatre/core';
however that just gives me an error
SyntaxError: [vite] Named export 'getProject' not found. The requested module '@theatre/core' 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 '@theatre/core';
const {getProject} = pkg;
I could technically just import it as vite says, but then when I add other imports from @theatre I get the same issue.
for example
import * as theatre from '@theatre/core';
import extension from '@theatre/r3f';
will give me a similar issue because @theatre/r3f is trying to do a named import of notify from @theatre/core.
So I am wondering if this is an issue that could somehow be solved by configuring vite?
Read more here: Source link
