Why does only ‘import without curlybracket’ work while with curly bracket is not working? for OrbitControls

I have a question about ES6 import module.

I tried to add OrbitControls in my Three.js Code. Since OrbitControls is a separate module, I needed to import them individually in my code as below. and it's working fine.

import OrbitControls from 'three-orbitcontrols'


What I first expected was

import {OrbitControls} from 'three-orbitcontrols'

The reason is,
As far as I understood, if the module export something as export default,
I can access them by putting curly bracketing in my 'import' code.
But,it didn't workout so I assumed that 'three-orbitcontrols' doesn't export "OrbitControls" as a default.

Then I tried like this

import * as Orbit from 'three-orbitcontrols'

new Orbit.OrbitControls(a,b)

However,it didn't work out either.

What did I misunderstand?

Read more here: https://stackoverflow.com/questions/67378906/why-does-only-import-without-curlybracket-work-while-with-curly-bracket-is-not

Content Attribution

This content was originally published by BS100 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: