Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

tyler-johnson
Copy link
Contributor

I went ahead and made the necessary changes for this plugin to work with babel 7. I think I managed to get everything working correctly, for both babel 6 and 7, so this should continue work for existing babel 6 users.

Summary of changes:

  • babel 7 seems to transform to _exports.default occasionally, so I look for that in addition to exports.default
  • getRootPath() doesn't go to the correct root path in babel 7 (which is the error in doesn't work with babel 7 #65). I have modified this to find the correct path for both UMD and everything else
  • babel 7 uses @babel/plugin-proposal-export-default-from for the default from syntax. This results in Object.assign(exports, "default", ...), so that needed to be properly detected at the initial traverse. I added CallExpression() which closes resembles your findExportsInCallExpression().
  • upgraded tests to test both babel 6 and 7, with the correct env preset and plugins.
  • two tests I could not bring over to babel 7, which I have commented on in the tests themselves.
    • should handle duplicated plugin references: babel 7 throws an error on duplicate plugins so this doesn't even run
    • should export with babel-plugin-rewire: babel-plugin-rewire hasn't been upgraded for babel 7 yet, see Babel 7 Support?  speedskater/babel-plugin-rewire#209

@wolfy1339
Copy link

I believe it would be better to just remove babel 6 altogether, do a major version bump, and call it a day

@kibertoad
Copy link

@59naga Could you please take a look at this? This is blocking a couple of projects that depend on this library.

@59naga 59naga merged commit b56a9a4 into 59naga:master Sep 11, 2018
@59naga
Copy link
Owner

59naga commented Sep 11, 2018

Awesome! thank you for a wonderful PR

@59naga
Copy link
Owner

59naga commented Sep 11, 2018

The PR has released as v1.0.0

@ljharb
Copy link

ljharb commented Oct 20, 2018

Heads up that this seems to have introduced a bug, which #70 fixes.

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

Successfully merging this pull request may close these issues.

5 participants