Comments (6)
what could be the best way here?
The nicest one would be to check for 'node_modules' and if its there, take the path part after it.
But that would also no be entirely correct, so maybe take the last part to show as template path and add a tooltip to show the full path?
though embroider should already take care of the leading path to app dir:
https://github.com/embroider-build/embroider/blob/main/packages/shared-internals/src/hbs-to-js.ts#L30.
or should this be fixed in embroider to ouput the same as classic builds?
edit: might also be ember-template-imports doing it?
edit2: "right, ember-template-imports could fix this by passing in moduleName here like ember-cli-htmlbars
edit3: found also this: https://github.com/emberjs/babel-plugin-ember-template-compilation/blob/main/src/plugin.ts#L296
so, the goal is to have moduleName be the real path? however i would argue that that is not a moduleName then. or at least not a useful one with all the linking in between...
also, I also do not see a way to remove the leading path to the root dir... I think this should really be fixed in embroider and ember-template-imports
from ember-inspector.
The key question here is: why do we think templates need this special form of debugging info to point back at their source, when we don't expect the same from every javascript module?
That distinction used to make sense, because templates used to be entirely separate from javascript. But now they are just values inside javascript. moduleName isn't even enough to uniquely locate a template anymore, given that you can have dozens of template tags in one module.
The inspector feature here should be more like a "jump to source" button. If instead of embedding moduleName
next to each compiled template we instead embedded a tiny function:
t.createTemplateFactory)({
id: "efyYydg8",
block: '[[[8,[39,0],null,null,null]],[],false,["four-oh-four"]]',
- moduleName: "pdpm-calc/templates/404.hbs",
+ debugHandle: function() {},
isStrictMode: !1
})
then at runtime the inspector can do window.inspect(theComponent.debugHandle)
and it will immediately open the Sources pane of the dev tools pointing directly at the right component.
(I think it has to be a function because window.inspect
is good at jumping to sources of functions, but it can't necessarily do the same for other kinds of objects.)
from ember-inspector.
@ef4 I would be open to that.
from ember-inspector.
@ef4 good idea, but then moduleName should not be set if nothing is passed to the template compiler. Currently the template compiler sets it to a filename
from ember-inspector.
I'm creating an RFC issue to centralize discussion of this problem: emberjs/rfcs#940
from ember-inspector.
Wee may still need moduleName
to support hot module replacement for components (in vite), at the moment we map changed component files to rendered components by moduleName
resolved from getComponentTemplate
or component itself. (https://github.com/lifeart/demo-ember-vite/blob/master/plugins/hot-reload.ts#L169)
from ember-inspector.
Related Issues (20)
- v4.8.0 on Chrome raises errors from Testem during Integration Tests
- ember inspector stops responding, error: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. HOT 2
- Including the `ember` npm package in app's dependencies breaks Ember Inspector HOT 2
- Ember Inspector release `4.9.0` failed to publish to Firefox HOT 1
- Ember inspector not loading: TypeError: window.requireModule.has is not a function HOT 3
- Property Inspector attempts nested access of a property whose name includes a period
- in-page-script.js inserted into Wordpress editor HOT 2
- Scroll to matches in component tree instead of filtering HOT 1
- Breaks on ember 5.2 w/ staticEmberSource: true HOT 17
- Could Ember Inspector deobfuscate component names? HOT 2
- Ember inspector 4.10 not working with 3.28 HOT 16
- Inspector not loading: issues with chrome api
- Inspector is stomping app's EmberENV HOT 6
- error when inspecting models HOT 2
- Ember application not detected with Firefox 120.0 HOT 8
- CalculateCPError on Nested Arrays with Objects & Unresponsive After Less than 3 Mintues
- Inspector Becomes Unresponsive When Left Open for a Few Minutes HOT 5
- Add support for Element Modifiers HOT 3
- Public API for 3rd party integration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-inspector.