Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

addImport() is deprecated in Babel 7 #110

Open
joshparolin opened this issue May 18, 2018 · 2 comments
Open

addImport() is deprecated in Babel 7 #110

joshparolin opened this issue May 18, 2018 · 2 comments

Comments

@joshparolin
Copy link

When trying to upgrade Babel 7, I experienced an error around the deprecation of addImport. Instead, the migration guide recommends using addDefault (reference: https://new.babeljs.io/docs/en/next/v7-migration-api.html#babel-core).

Error:

This API has been removed. If you're looking for this functionality in Babel 7, you should import the '@babel/helper-module-imports' module and use the functions exposed  from that module, such as 'addNamed' or 'addDefault'.

Case 1:

const transformImportId = this.file.addImport(transformName, 'default', transformName);

Case 2:

return this.file.addImport(importName, 'default', importName);

I attempted to fork, but wound up spinning my wheels for too long. Any insight on how to best migrate would be much appreciated.

@nodkz
Copy link

nodkz commented Jun 6, 2018

@joshparolin @kozlikov

You may install https://www.npmjs.com/package/metro-babel7-plugin-react-transform
and copy its lib/index.js to your node_modules/babel-plugin-react-transform/lib/index.js via postinstall script.

@camsjams
Copy link

camsjams commented Jan 8, 2019

Switching over to react-hot-loader as prescribed is the best option (was for us at least 👍 )

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants