Closed subvertallchris closed 4 years ago
this .babelrc
below maybe help you.
{
"presets": ["@babel/preset-env", { "modules": "commonjs"}],
"plugins": ["add-module-exports"]
}
@babel/preset-env
with commonjs option will handle the warning but the variables will be undefined
.
@qingguoing even after adding this two settings exports
variable is undefined
for me. How to get proper values for the same?
this
.babelrc
below maybe help you.{ "presets": ["@babel/preset-env", { "modules": "commonjs"}], "plugins": ["add-module-exports"] }
@babel/preset-env
with commonjs option will handle the warning but the variables will beundefined
.
The code and .babelrc
provided is incorrect and would fail to parse - you need an array around your presets.
I solved it by adding
plugins: ["@babel/plugin-transform-modules-commonjs"]
I solved it by adding
plugins: ["@babel/plugin-transform-modules-commonjs"]
Thanks! save my time!
I 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:After that, I'm able to call upon
FBXLoader
without any trouble.Since upgrading to Babel 7, I get this warning:
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.