Skip to content

three/addons alias #336

@CodyJasonBennett

Description

@CodyJasonBennett

Describe the feature you'd like:

Since r144 (mrdoob/three.js#23406), three.js supports a three/addons alias that would currently redirect to three/examples/jsm.

For instance, the following resolve to the same file:

import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'

Suggested implementation:

TypeScript doesn't recognize the above behavior since the alias is currently handled through package.exports and types only exist for examples/jsm on disk (this might be something to check in TypeScript upstream). We can implement this by copying examples/jsm to addons at build-time if there's no easy way to alias as a library.

You can work-around this in user-land with:

{
  "compilerOptions": {
    "paths": {
      "three/addons/*": ["./node_modules/three/examples/jsm/*"]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions