Skip to content

Ensure external helpers are not used when modules are not transpiled. - #267

Merged
rwjblue merged 1 commit into
emberjs:masterfrom
rwjblue:tweak-should-include-external-helpers
Feb 12, 2019
Merged

rwjblue merged 1 commit into
emberjs:masterfrom
rwjblue:tweak-should-include-external-helpers

Conversation

@rwjblue

@rwjblue rwjblue commented Feb 12, 2019 •

Copy link
Copy Markdown
Member

When using something akin to the following somewhat common pattern:

let babel = this.addons.find(addon => addon.name === 'ember-cli-babel');
let tree = babel.transpileTree(input, {
  'ember-cli-babel': {
    compileModules: false,
  }
});

The previous logic would still attempt to use external helpers even when modules themselves are not being transpiled. This meant that the final output would include untranspiled import statements.

This affects common addons such as:

  • ember-fetch
  • ember-service-worker
  • ember-data
  • @ember/test-helpers
  • ember-angle-bracket-invocation-polyfill
  • ember-modifier-manager-polyfill

The fix here is to detect that modules will not be compiled, and avoid usage of the external helpers.

This also moves the validation that parent addon's do not specify includeExternalHelpers in their own config to the shared getAddonConfig method (and makes the logic in that method a bit easier to grok).


Fixes ember-polyfills/ember-modifier-manager-polyfill#4

When using something akin to the following somewhat common pattern:

```js
let babel = this.addons.find(addon => addon.name === 'ember-cli-babel');
let tree = babel.transpileTree(input, {
  'ember-cli-babel': {
    compileModules: false,
  }
});
```

The previous logic would still attempt to use external helpers even when
modules themselves are not being transpiled. This meant that the final
output would include untranspiled `import` statements.

This affects common addons such as:

* ember-fetch
* ember-service-worker
* ember-data
* @ember/test-helpers
* ember-angle-bracket-invocation-polyfill
* ember-modifier-manager-polyfill

---

The fix here is to detect that modules will not be compiled, and avoid
usage of the external helpers.

This also moves the validation that parent addon's do not specify
`includeExternalHelpers` in their own config to the shared
`getAddonConfig` method (and makes the logic in that method a bit easier
to grok).
@rwjblue
rwjblue merged commit 3a448df into emberjs:master Feb 12, 2019
@rwjblue
rwjblue deleted the tweak-should-include-external-helpers branch February 12, 2019 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Package presence causes SyntaxError in CI

2 participants