-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Description
Is your feature request related to a problem? Please describe.
When using the esbuild build tool, the import statement reports an error that cannot be resolved.
E.g:
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
This is because of the following configuration:
"exports": {
"./examples/jsm/*": "./examples/jsm/*"
}
Although tools like rollup, webpack, etc. may be normal, obviously esbuild respects node specification standards more.
According to the node specification, in order for the esbuild tool to work properly, the file extension needs to be added:
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js';
Obviously when this happens, many people need to spend as much time as I do to analyze the cause of the problem.
In fact, the following configuration can also solve the problem:
"exports": {
"./examples/jsm/*": "./examples/jsm/*.js"
}
In order to improve development efficiency (compilation speed), esbuild
should have been widely used, can this problem be solved?
see also evanw/esbuild#2518
Describe the solution you'd like
- For files of the same type (such as
.js
), change theexports
configuration in package.json, for example
"exports": {
"./examples/jsm/*": "./examples/jsm/*.js"
}
- For different categories of files contained in a folder, multiple configurations can be written, or it is clearly mentioned in the documentation that developers should write extensions when importing?
"exports": {
"./examples/jsm/*.js": "./examples/jsm/*.js",
"./examples/jsm/*.png": "./examples/jsm/*.png"
}
Describe alternatives you've considered
Additional context