Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

babel-runtime is not properly replaced #94

Closed
nkzawa opened this issue Nov 6, 2016 · 1 comment
Closed

babel-runtime is not properly replaced #94

nkzawa opened this issue Nov 6, 2016 · 1 comment

Comments

@nkzawa
Copy link

nkzawa commented Nov 6, 2016

When you compile the following code:

// The issue occurs only if it's:
//                               
// - function declaration (not function expression or arrow function)
// - export (not export default)

export async function test () {}

with the settings:

"plugins": [
  "trannsform-async-to-generator",
  "transform-es2015-modules-commonjs",
   "transform-runtime",                                                                                                                     
   [
     "module-resolver",
     {
        "alias": {
           "babel-runtime": "./my-babel-runtime"
        }
     }
   ]
]                                                                                                                                               

require call of babel-runtime is wrongly placed to end of the file, so it throws an error when you run the code. I think it can be the issue of babel rather than this plugin, but reported here first anyway.

Original issue was repored here: vercel/next.js#202
You can reproduce the issue with https://github.com/nkzawa/babel-plugin-module-resolver-issue

@tleunen
Copy link
Owner

tleunen commented Nov 6, 2016

Thanks @nkzawa, I'm taking a look at it.

tleunen pushed a commit that referenced this issue Nov 6, 2016
When an alias for babel-runtime was set, the require call was wrongly placed at
the end of the file.

Closes #94
@tleunen tleunen closed this as completed in e7083ab Nov 6, 2016
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

No branches or pull requests

2 participants