emberjs / emberjs/ember-cli-babel

Error transpiling some Ember functions

Open
#198 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
152
Forks
115
Avg merge
23h 22m
Merged PRs (30d)
4

Description

Hi, I'm trying to use the new import syntax (`@ember/package`) but I think I found an issue when using some Ember functions (like `Ember.warn`).

For example, this piece of code...

```
import { warn } from '@ember/debug';

const a = () => warn('a');
const b = () => { warn('b') };
const c = () => { return warn('c') };
const d = function(){ warn('d') };
const e = function(){ return warn('e') };
```

Produces this after building the application:

```
var a = function a() {
return warn('a');
};
var b = function b() {
(true && Ember.warn('b'));
};
var c = function c() {
return warn('c');
};
var d = function d() {
(true && Ember.warn('d'));
};
var e = function e() {
return warn('e');
};
```

In the example, the functions `b` and `d` are correct but the `a`, `c` and `e` are not ok because it will throw a `ReferenceError`.
For some reason, **only the functions that returns something** have the wrong code.

Don't know if this is the correct repo to publish this issue but I think it could be related with babel transformations.

_I've tested it in my companies application, and an empty projects using `v2.16.2` and `v2.18.0`._

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.