question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning of exports not found after Babel 7 upgrade

See original GitHub issue

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:

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:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

70reactions
RobinHerbotscommented, Sep 6, 2019

I solved it by adding

plugins: [“@babel/plugin-transform-modules-commonjs”]

15reactions
qingguoingcommented, Dec 6, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Latest Babel (@babel/core v7) error "exports is not defined"
I'm using TS and JS in the same project (i plan on moving everything to TS later on). Well anyway, i suppose it...
Read more >
Upgrade to Babel 7
Because not every breaking change will affect every project, we've sorted the sections by the likelihood of a change breaking tests when upgrading....
Read more >
babel-loader - npm
The path of a module that exports a custom callback like the one that you'd pass to .custom() . Since you already have...
Read more >
To v5 from v4 - webpack
Upgrade webpack 4 and its plugins/loaders · Make sure your build has no errors or warnings · Make sure to use mode ·...
Read more >
Migrating from v2 to v3 - Gatsby
While this might indicate that the plugin has incompatibilities, in most cases they should continue to work. When using npm 7, you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found