Open trusktr opened 2 years ago
I see! this works a little better, but not quite:
options: {
modules: {
three: {
components: 'src',
},
},
},
I took a look! I see it is using TS for the AST. Maybe instead we can tell TS to resolve the original file location of given item, to get the path that way.
Hmmm, check out this getSourceFile
method. Maybe we can use that.
Here for example is a Three.js component that imports everything from an index, importing the whole Three.js lib:
https://github.com/mrdoob/three.js/blob/f9331aa74f87b12e91f34886e0ed54b8d79b31bf/examples/jsm/controls/OrbitControls.js#L1-L9
When I try to set the loader config,
the build has an error:
Besides that Webpack is trying to obey
exports
field, it is also trying to import the wrong path.three/LinearMipmapLinearFilter
is not the file where that thing comes from; it comes fromthree/src/constants
.I wonder if there's a way to make it correctly detect the path of items.