ember-let icon indicating copy to clipboard operation
ember-let copied to clipboard

`ember-let` fails to work with Ember ~3.1. `ember-glimmer/syntax` package does not exist.

Open patocallaghan opened this issue 6 years ago • 4 comments

Version of ember-let:

0.7.1

Ember Version / Ember CLI Version:

Ember Version: 3.1.4 Ember CLI Version: 3.2.0

Expected Behavior

The Ember app or tests should run as normal.

Actual Behavior

An exception is thrown when trying to load the code to register the ember-let macro and the page fails to load.

https://github.com/thefrontside/ember-let/blob/b586fdd13257a2082a2bcc418752e21309c3e6fb/vendor/ember-let/current/register.js#L2

The ember-glimmer/syntax package no longer exists in Ember ~3.1 and throws the following exception.

Uncaught Error: Could not find module ember-glimmer/syntax
    at missingModule (loader.js:12)
    at internalRequire (loader.js:34)
    at Object.requireModule [as require] (loader.js:84)
    at register.js:2

Steps To Reproduce:

  1. Install ember-source ~3.1
  2. Run ember s
  3. The page fails to load and exceptions are thrown in the console

Ember Twiddle / Example repo / Failing test:

https://github.com/patocallaghan/ember-let-bug

patocallaghan avatar Oct 16 '18 07:10 patocallaghan

Hey @patocallaghan! The good news is Ember 3.1 shipped an official version of {{let}}: https://www.emberjs.com/api/ember/3.1/classes/Ember.Templates.helpers/methods/?anchor=let

Would you be able to migrate to that?

Robdel12 avatar Oct 16 '18 15:10 Robdel12

It appears {{let}} actually didn't ship until 3.2 even though the 3.1 API docs mention it https://www.emberjs.com/blog/2018/07/02/ember-3-2-released.html#toc_new-features-1

As a workaround I opted to just use https://github.com/cafreeman/ember-let-polyfill instead as this seems to handle it. It seems the new path is here:

const { _registerMacros } = Ember.__loader.require('ember-glimmer');

https://github.com/cafreeman/ember-let-polyfill/blob/c1751045004ad8df36716e1b0885ab5ed7e11144/vendor/ember-let/ember-lt-3-1/register.js#L2

I'd be happy to contribute a fix using the same ^ if you wanted it? Or should this addon just use ember-let-polyfill as a dependency?

Ember.js helps developers be more productive out of the box. Designed with developer ergonomics in mind, its friendly APIs help you get your job done—fast.
GitHub
A polyfill for the `let` helper in Ember
GitHub
A polyfill for the `let` helper in Ember

patocallaghan avatar Oct 16 '18 15:10 patocallaghan

yes, IMHO this addon should use ember-let-polyfill and focus solely on supporting inline let (which is the main feature difference between the shipped feature and what we have in this repo)...

rwjblue avatar Oct 16 '18 15:10 rwjblue

@rwjblue @Robdel12 I'd be happy to PR this.

What's the best way to include the dependency? Adding straight to dependencies in the package.json? Or should it be conditionally included through index.js because from 3.2 the polyfill is not needed?

patocallaghan avatar Oct 16 '18 17:10 patocallaghan