Import EffectComposer

I’m developing a site with Nuxt.js and I’m importing three.js from npm. It’s works fine, but when I try to import EffectComposer from the examples it’s give me this error, ‘Must use import to load ES Module.’ In fact none of the examples can be run in this environment for the same reason.
How can I import it?
Thanks

1 Like

do you use import or require? And from what path do you try to import it?

Something like that:
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer';

?

I’m using import and it’s exactly like you post.
When I try to use, it gives me this error.

@hex13 Thanks for your time. The error becomes from the Nuxt.js config and I fixed it writing a little bit of code inside the build function in my nuxt.config.js

build: {
    transpile: [
      'three'
    ],
  }
1 Like