-
Notifications
You must be signed in to change notification settings - Fork 287
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
Inspector doesn't detect the app with ember-source
v6.1 (under embroider)
#2612
Comments
ember-source
v6.1ember-source
v6.1
since ember-source is now a v2 addon, no AMD modules are beeing created. So inspector cannot detect them. There is only a AMD compat mode for classic builds without embroider. import Ember from 'ember';
import * as runtime from '@glimmer/runtime';
import * as tracking from '@glimmer/tracking';
import * as validator from '@glimmer/validator';
import { RSVP } from '@ember/-internals/runtime';
import config from './config/environment';
window.define('@glimmer/tracking', () => tracking);
window.define('@glimmer/runtime', () => runtime);
window.define('@glimmer/validator', () => validator);
window.define('rsvp', () => RSVP);
window.define('ember', () => ({ default: Ember }));
window.define('<my-app>/config/environment', () => ({
default: config,
})); |
@patricklx this does not seem ideal, is there any way we can fix this? |
Same issue here.
|
@emberjs/framework This seems like a pretty critical issue we need a fix for. |
To be clear, this is an issue under embroider builds on ember > 6.1. We were careful not to destabilize the default build and the inspector should work fine in a completely default ember 6.1 app. But yes, the inspector makes assumptions about AMD that we can't possibly continue to support in an ES modules world. |
Thanks for the context @ef4! Any thoughts on how we can support both going forward? It would be great if we could patch this and get some new versions out. |
It would be helpful if somebody wants to clean up and centralize all the ways inspector is accessing modules from ember. I see It's also not clear to me whether the loader in inspector's ember_debug.js is allowed to interoperate with the app's own AMD loader. If yes, that needs to be untangled. It would probably be less confusing if ember_debug.js got built by Rollup instead of doing the custom-broccoli-pipeline-to-AMD thing. That would make it easier to see where there are real interactions with the app's modules vs the inspector's modules. Another thing that could be helpful is if there are significant branches for dealing with older ember versions, let's do the snapshotting thing described by the readme and get them out of the maintained codebase, so we have less variety of Ember APIs to worry about replacing. |
I don't know to what extent things are broken right now, and to what extent they can be hacked to sort of work with a quick fix, but ultimately the current setup is unsustainable and needs to be completely flipped around. There are a few category of things that the inspector (more specifically, ember_debug – the code that runs inside the same page as the app) is trying to access via loader.js: (To be clear
Historically, because the loader is present at runtime, very little consideration goes into vetting what functionalities should the inspector support; if someone can figure out how a hack by poking deep enough to get some useful information at runtime, then the feature gets added. Ultimately I don't think that is very sustainable, and also the relationship needs to be flipped. The inspector needs to define the fundamental and relatively stable APIs it needs – say, "tell me the Ember version", "give me the application instance", "what routes are defined", "is this value a X", etc, and those needs to be bound, at runtime, to an runtime adapter provided by (and proactively registered by) the app bundle. It's not very different from, say, how libc works/how native apps can work across multiple operating system versions. It's not that the application developers are supposed to implement any of those things in their app manually, but that should be indirected via a separately maintained layer, though some kind of plugin in the build may still be necessary to generate/inject some boilerplate into the bundle. A possible version of this is:
The last step is very hand-wavy, so additionally, here is one possible way to do that:
I took a small stab at that years ago with someone at LinkedIn: https://github.com/emberjs/ember-debug. The constraints were different back then, and I think it was still written with the assumption that the (To be clear, I am not signing up to do this, but I think this is useful context for someone trying to understand the state of things and a potential path forward.) |
@ef4 yes, it can. But it's unnecessary now. I untangled it some time ago. So, no
Though all mixin classes are only imported so that they instance can be checked and the name can be shown by inspector. @chancancode there is already ongoing things. |
@ef4 We currently require Ember 3.16+ and versions before that get older versions of inspector. I was planning to require 3.28+ next but we could also make that something in the 4.x series if it is helpful. @chancancode I totally agree that it would be ideal to flip the way inspector works. However, we now have a stable version of Ember out for which inspector does not work. My preference would be to find a way to fix this for folks now and free ourselves up to be able to do this major refactor at a slower pace. |
In my previous comment I deliberately didn't go into the implementation details of how ember can provide the debug APIs, but we already have the infrastructure to support that and it's simpler than what is being discussed.
globalThis.loadInspectorSupport = async () => {
return await import("./the-stable-inspector-api");
} Apps will not need any boilerplate and no macros are required. What will happen is your build tool (including ember-auto-import in classic builds) will emit an extra javascript chunk due to the presence of the above dynamic import, and that chunk will deploy alongside your other chunks, and the inspector can load it on demand. So yes, there are two things to design. Godfrey is correct that we really really need to design a stable API. That would be the interface returned from And we should also design a reasonably flexible discovery mechanism. One that is insensitive to timing and that supports multiple ember apps simultaneously. A single global function like my example is too simple for reality. |
I would add that Embroider can easily polyfill this feature on ember versions that lack it. |
@ef4 I don't disagree, but I do think we need to prioritize this. Are you thinking we would patch ember-source back to 3.28 to do this or put in some conditional logic like if on 6.x do the new stuff? |
As far as I know, stable embroider releases work with inspector up to ember 6.1. I don't think we need to back port a new feature very far. Also I think we can keep the split beteeen the current implementation and the new implementation pretty clean. Inspector can ship with its own polyfill of the new ember feature that works on all the currently-working releases. |
@ef4 gotcha. So what is our plan of action here? I could help implement, if someone can help me figure out where/how 😅 |
ember-source
v6.1ember-source
v6.1 (under embroider)
Describe the bug
After updating my app to v6.1 (and also with new ember app), the inspector isn't working anymore.
The inspector doesn't detect the app.
With 6.0 it works without any issues
To Reproduce
ember new new-app --embroider --pnpm --typescript
Expected behavior
Inspector should find the app
Screenshots

Environment
Ember cli: 6.1
Ember version: 6.1
Embroider: latest
Browser: Chrome / Firefox
The text was updated successfully, but these errors were encountered: