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

Unexpected deprecations when running against Ember 3.27+ #738

Closed
rwjblue opened this issue Mar 25, 2021 · 7 comments · Fixed by #740
Closed

Unexpected deprecations when running against Ember 3.27+ #738

rwjblue opened this issue Mar 25, 2021 · 7 comments · Fixed by #740
Labels
bug Something isn't working

Comments

@rwjblue
Copy link
Collaborator

rwjblue commented Mar 25, 2021

The @embroider/util ember-beta and @embroider/util ember-canary CI jobs are failing due to new deprecations added in Ember 3.27 (currently in beta).

Example failure:

not ok 1 Chrome 89.0 - [213 ms] - Integration | Helper | ensure-safe-component: string value
    ---
        actual: >
            Usage of the Ember Global is deprecated. You should import the Ember module or the specific API instead.
        expected: >
            
        stack: >
                at Object.eval (webpack:///./tests/deprecation-assertions.js?:118:12)
                at callHook (http://localhost:7357/assets/test-support.js:5101:28)
                at runHook (http://localhost:7357/assets/test-support.js:5129:11)
                at processTaskQueue (http://localhost:7357/assets/test-support.js:4683:33)
                at advanceTaskQueue (http://localhost:7357/assets/test-support.js:4668:5)
                at Object.advance (http://localhost:7357/assets/test-support.js:4654:5)
        message: >
            Unexpected deprecations
@ef4
Copy link
Contributor

ef4 commented Mar 25, 2021

I ran ember-cli-update in util here and fixed the one issue that seems to really be in this package.

There are several others in dependencies that seem like they shouldn't be firing. For example, ember-resolver/resolvers/classic/index is throwing the deprecation, even though I can see it's original source uses the Ember import.

Is there some update to the modules-api-polyfill that's missing? Because it did compile that import to a global.

@ef4
Copy link
Contributor

ef4 commented Mar 25, 2021

Re-rolling the lockfile fixed some of these, but now I think the monorepo is allowing some older version to leak out of the sample apps somehow.

@rwjblue
Copy link
Collaborator Author

rwjblue commented Mar 25, 2021

There are several others in dependencies that seem like they shouldn't be firing. For example, ember-resolver/resolvers/classic/index is throwing the deprecation, even though I can see it's original source uses the Ember import.

You need ember-resolver@8 (the default blueprint updated to that a while back). The older ember-resolver was basically class Resolver extends Ember.Resolver {} but now we don't extend at all from the globals resolver.

I ran ember-cli-update in util here and fixed the one issue that seems to really be in this package.

@ef4 - There is still at least one major issue here in Embroider still:

let func = memberExpression(memberExpression(identifier('Ember'), identifier('HTMLBars')), identifier('template'));
path.replaceWith(callExpression(func, [jsonLiteral(compiled)]));

The babel plugin (https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile) that is used in classic builds has been updated to account for this (it adds imports instead of the older globals based code), but it seems like we are intentionally duplicating the inline transform here (and I'm not sure why). Do you recall why we needed to duplicate the code? Can we instead add additional options to the main shared babel plugin to do whatever Embroider needs?

@ef4
Copy link
Contributor

ef4 commented Mar 26, 2021

Do you recall why we needed to duplicate the code?

The major differences are:

  • we can run in stage: 1 mode, which only applies custom transforms and re-emits the hbs
  • in stage: 3 mode, our TemplateCompiler does build-time resolution within templates and emits JS imports in addition to just precompiling the HBS.

There's no reason we can't upstream these capabilities into babel-plugin-htmlbars-inilne-precompile, that was just not a priority.

@ef4
Copy link
Contributor

ef4 commented Mar 26, 2021

This ember-cli-babel bug is causing some of our deprecations: emberjs/ember-cli-babel#396

@ef4
Copy link
Contributor

ef4 commented Mar 26, 2021

Also, ember-inspector is causing deprecations.

Also, ember-cli itself is causing one in contentFor('test-body-footer'). I see that a newer ember-cli would fix that, but we use the default ember-try config which only updates ember-source, not ember-cli.

@rwjblue
Copy link
Collaborator Author

rwjblue commented Mar 26, 2021

ember-cli itself is causing one in contentFor('test-body-footer'). I see that a newer ember-cli would fix that, but we use the default ember-try config which only updates ember-source, not ember-cli.

Ya, I’ll be back porting the ember-cli fix to 3.24, 3.25, and 3.26.

@ef4 ef4 closed this as completed in #740 Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants