Three.js: Suggestion: export default value in `src/Three.js`

Created on 4 Aug 2020  Â·  2Comments  Â·  Source: mrdoob/three.js

// current
import * as THREE from 'three';

// suggestion
import THREE from 'three';
Suggestion

Most helpful comment

Usually, I prefer to import only what I need in a module:

Module: camera.js

import { PerspectiveCamera } from 'three';

Module: renderer.js

import { WebGLRenderer } from 'three';

All 2 comments

Usually, I prefer to import only what I need in a module:

Module: camera.js

import { PerspectiveCamera } from 'three';

Module: renderer.js

import { WebGLRenderer } from 'three';

Yeah, I don't think we can do this, sorry. See https://rollupjs.org/guide/en/#default-export —

This practice is only recommended if your source module only has one export.

It is bad practice to mix default and named exports in the same module, though it is allowed by the specification.

Was this page helpful?
0 / 5 - 0 ratings