Warning of exports not found after Babel 7 upgrade
See original GitHub issueI think this might be Babel’s issue but I’m posting here because others are likely to encounter it and it might be worth considering on this end.
Three.js provides some classes that aren’t available by default but can be treated as mixins by requiring them. Unfortunately, they all expect a global THREE
so I’ve been working around it with this loader. My process has been:
require('imports-loader?THREE=three!/three/examples/js/loaders/FBXLoader.js');
import { FBXLoader } from 'three'
After that, I’m able to call upon FBXLoader
without any trouble.
Since upgrading to Babel 7, I get this warning:
"export 'FBXLoader' was not found in 'three'
That happens as a result of the import
call, not the require. There’s an issue over at Babel that almost describes my problem except I’m not using Babel’s TypeScript integration, which leads me to wonder if this isn’t due to TypeScript and is instead something that can be addressed here. I unfortunately don’t know enough about the import/export process to really troubleshoot on my own.
As it stands, this is being reported as a warning, not an error, so my webpack builds succeed, but it’s awfully annoying and hides build output information that I’d like to see. I’m happy to take this elsewhere if you determine this is truly babel’s problem. I appreciate your help on this.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
I solved it by adding
plugins: [“@babel/plugin-transform-modules-commonjs”]
this
.babelrc
below maybe help you.@babel/preset-env
with commonjs option will handle the warning but the variables will beundefined
.