Skip to content

Transpilation issue with v2 beta #336

Open

Description

@rmachielse

First of all, thanks a lot for the v2 refactor! It must be much more efficient because the build time of our large app in CI went down by many minutes❗ by upgrading to the v2 beta.

Unfortunately, we ran into a strange issue that we are only seeing when building with COVERAGE=true.

I was able to reduce the reproduction to just this:

import { assign, merge } from '@ember/polyfills';

const test = assign || merge;

When building without coverage, this properly transpiles to:

const test = Ember.assign || Ember.merge;

However when building with coverage, it transpiles to:

const test = (cov_...().s[0]++, (cov_...().b[0][0]++, assign) || (cov_...().b[0][1]++, merge));

This doesn't work because assign and merge are undefined.
However when using this line:

const test = assign;

It works fine as this transpiles correctly to:

cov_...();
const test = Ember.assign;

The issue is not related to assign/merge, because the same happens when using isPresent/isEmpty from @ember/utils.

We can avoid the issue by not using any || operator with imported functions, but I wanted to report this anyway.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions