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

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

Merged

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Feb 12, 2019

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