if (
macroCondition(
dependencySatisfies('ember-source', '>=3.27.0-canary || >=3.27.0-beta')
)
) {
// new enough ember has a real module we can import
runtime = importSync('@glimmer/runtime');
} else {
// older ember has its own internal loader
runtime = window.Ember.__loader.require('@glimmer/runtime');
}
The project uses version 3.28.6 of ember-source so the else branch shouldn’t be executed but for some reason it still does, triggering the deprecation.
Having read what @ef4 said on the other thread, I was looking for some other dependency that might pull in ember-source but there are lots, as a lot of add-ons have ember-source as a devDependency.
However, if I’m not mistaken, if Project A has a devDependency on Package B, and Package C is a devDependency of Package B, if I (yarn) install Project A, Package C will not be installed so as long as some add-on doesn’t have a (non-dev) dependency on ember-source, there’ll only ever be one ember-source in the whole of node_modules. Which is what I see when running yarn why ember-source.
Reading the source code it uses the package cache and Ed mentioned there is an outstanding bug, so I cleared the cache before building the app but it didn’t help.
Unfortunately putting breakpoints in Embroider code or logging out stuff didn’t get me very far so far so maybe understanding how a package dependency is resolved (specifically the pkg = packageCache.resolve(packageName, us); line in the implementation of dependencySatisfies) can unblock me faster.
Is there a monorepo or yarn linking involved? We have repeatedly seen that both yarn and NPM won’t honor peer dependencies correctly in those situations, and I can recommend pnpm as more correct.
dependencySatisfies follows node resolution. So if you cd into the directory where ember-private-api.js is installed, and in that directory run node -e 'console.log(require.resolve("ember-source/package.json"))' it will tell you which copy it is seeing.
I’m not sure if there are peerDependencies involved (I can check at a saner hour) but I gave this a try with pnpm and it just works, without throwing any errors .
I guess the question is now how stable/reliable pnpm is to adopt it as the package manager for a large, “real” project