Hey,
I try to include an addon v2 in an Ember app, but just by including it, I get build errors for every import from that addon, like this one:
WARNING in models/article-link.js 4:361-365
export 'attr' (imported as 'attr') was not found in 'ember-data/model' (possible exports: default)
@ ../../../../../../../../tmp/broccoli-44252FbQ8ZgQ06Ijl/cache-341-webpack_bundler_ember_auto_import_webpack/app.cjs 297:116-153
....
ERROR in ../models/dist/transforms/visibility.js 1:298-339
Module not found: Error: Can't resolve '@ember/application' in 'models/dist/transforms'
@ ../../../../../../../../tmp/broccoli-35068LcBLK7ohcYmS/cache-341-webpack_bundler_ember_auto_import_webpack/app.cjs 386:120-159
Any thoughts on how I can debug this?
Best,
Bogdan
from the error it appears you are using an extremely old version of ember-data. Importing v1 addons from v2 addons is dicey, doing so with a very old version is especially unlikely to work.
Or, if you are using a newer version, the issue may just be a mistyped import. Typically attr
is imported like import { attr } from '@ember-data/model
, while the much older version of this was import attr from 'ember-data/attr';
. I’m not aware of import { attr } from 'ember-data/model';
ever having worked tbh.
indeed I tried to update from ember-data 5 to 6, but those imports don’t look like the source of the errors. This an example file with the error:
import Model, { attr } from 'ember-data/model';
export default class ArticleLinkModel extends Model {
@attr('string') url;
@attr('string') articleId;
}
and another one with errors with ember imports:
/**
Copyright: © 2015-2025 GISCollective
License: Subject to the terms of the AFFERO GENERAL PUBLIC LICENSE, as written in the included COPYING file.
*/
import Transform from 'ember-data/serializer/transform';
import { getOwner } from '@ember/application';
import { tracked } from '@glimmer/tracking';
import { later } from '@ember/runloop';
export class Visibility {
@tracked isPublic;
@tracked isDefault;
@tracked _team;
@tracked teamId = '';
/// ....
}
But I will try to double-check those imports and see if this is the issue. Also, I want to mention that the addon builds without errors; only apps using this addon fail, including the associated test app.
Yes, indeed it was an import issue. It is very confusing, though, because building the addon does not raise any error. I assume this is an issue with rollup.