Open JonathanWilbur opened 1 month ago
Bump. I have the same issue on nsfwjs@4.1.0
with node v20.16.0 and SvelteKit & vite.
I am having this issue with SvelteKit but using TypeScript not JavaScript. Did anyone figure out how to get this imported
I did this in a TypeScript project and it worked for me: import * as nsfwjs from "./node_modules/nsfwjs/dist/cjs/index.js";
.
That's obviously sloppy; you shouldn't have to do it. But it works.
Thanks for the temp fix @JonathanWilbur. I got it to work with that but importing the /esm/index.js
. Haven't tested my full code yet, this looks more hopeful than manually importing TensorFlow and recreating the library
Hello, when importing this in a Javascript (clarifying that it is not Typescript) program, I get the following error:
Even if I go in
nsfwjs
'spackage.json
and add"type": "module"
manually, I get another strange error:My application is a single file that has an extension
.mjs
and I have"type": "module"
in mypackage.json
.My suspicion is that this has been tested with (1) TypeScript that compiles to CommonJS, and (2) Javascript / CommonJS, and the ESM module never worked properly. I am not sure what it would take, though; the
package.json
looks correct to me.For reference, I am also importing several other ESM modules in my
main.mjs
prior to this one, so this isn't a problem with loading ESM modules in general.I am using
Node.js v20.16.0
.Thanks in advance for your help. I'd be happy to offer more information or even contribute code to fix this.