Closed IgnaceMaes closed 4 months ago
I ran into this issue last week too as well as when I try to call perform
on a task in my V2 addon, I get this error:
ui-button.js:43 Uncaught TypeError: this.buttonTask.perform is not a function
Edit: When I manually registered the Babel plugin like what you said, it also fixes this issue too.
I had the exact same issue but inside my app (not an addon).
While investigating, I realised the culprit was the coverage 🤔
If you are trying to launch you test with coverage like so
COVERAGE=true ember build --environment=test
this will fail.
To fix it your solution works, we just have to specify the ember-concurrency plugin BEFORE the one of ember coverage
// ember-cli-build.js
babel: {
plugins: [
require.resolve('ember-auto-import/babel-plugin'),
require.resolve(
'ember-concurrency/lib/babel-plugin-transform-ember-concurrency-async-tasks',
),
...EmberCodeCoverage.buildBabelPlugin(),
],
sourceMaps: 'inline',
},
@VincentMolinie that's interesting. I'm not using ember coverage in my addon, so I still think there's something else going on.
I'm having a similar issue with using perform
in a brand new Ember 5.3 app.
I get a perform is not defined
error.
I tried manually registering the Babel plugin but no success so far.
I have also got this error while migrating the addon to v2 (fixed like described in comment)... is there planned to convert this addon to v2? Its the last of my dependency (excluded cli's) which is not a v2 addon
@mkszepp Definitely plans to convert this addon to v2 but I am personally too busy to do it right now and I'd have to do a lot of catching up to understand everything that needs to happen. Would love to have a champion to help out with this, and I think the community could provide plenty of help in the #e-concurrency
Discord channel.
I'm having a similar issue with using
perform
in a brand new Ember 5.3 app. I get aperform is not defined
error.I tried manually registering the Babel plugin but no success so far.
Can you provide more information about this? Is it possible you're perform
in a .gts/.gjs file and you don't have an import for it?
The addon is now migrated to an addon V2 (see https://github.com/machty/ember-concurrency/releases/tag/4.0.0). Thank you @machty and everyone which has helped to bring this to an V2 addon. 🎉
The original reported error should resolved with v4 release. I think the problem with perform
is not directly related to this issue.
It seems that even with v4 released, v2 addons still need to have following
node_modules/ember-concurrency/async-arrow-task-transform
in babel.config.json
would it make sense to add this information to migration guides?
@aklkv it is already documented here http://ember-concurrency.com/docs/v4-upgrade and here https://github.com/machty/ember-concurrency?tab=readme-ov-file#installation
As reminder: v2 addons are static (like non ember addons) and not dynamic like v1 addons, for this reason this is generally necessary
@mkszepp it documents everything but v2 addon which might be confusing as it was for me, some might assume that it work would work without any extra configurations in v2 environment
Addons V2 are static, magically parts like in V1 addons are not possible.
V2 addons are working like every other addon which you get from npm (excluded ember addons). There is always necessary a little configuration. You will see this manual steps in future in more and more modernized addons.
Here the RFC link to V2 addon format, maybe this helps you better to understand this way https://rfcs.emberjs.com/id/0507-embroider-v2-package-format/
I hit the following issue when using
ember-concurrency
in a brand new V2 addon:After a bit of fiddling around I found that manually registering the Babel plugin resolves this. This can be done by adding the following line in the
your-v2-addon/babel.config.json
file:Is this intended behaviour? And if so, should it be documented?