Non dynamic component in template considered unsafe unless called with <this.component />
See original GitHub issueI’m trying to get an ember 3.26 app to work with embroider with
staticAddonTestSupportTrees: true,
staticAddonTrees: true,
staticHelpers: true,
staticComponents: true,
When building the app I get errors for all template files that contain call normal non-dynamic components like this:
ERROR in ./templates/login.hbs
Module Error (from ../../../../../../../../Users/user/ember-web/node_modules/thread-loader/dist/cjs.js):
Unsafe dynamic component: cannot statically analyze this expression in templates/login.hbs
@ ./assets/ember-web.js 1481:13-44
The template in question looks like this:
{{page-title "Login"}}
{{#if this.showBranding}}
<div class="login split">
<div class="split__page">
<LoginForm class="bright-form bright" />
</div>
</div>
{{else}}
<div class="login centered">
<div class="centered__page">
<LoginForm class="bright-form bright" />
</div>
</div>
{{/if}}
But the above Unsafe dynamic component error does not happen if I call the component with this.
in front of the component name.
{{page-title "Login"}}
{{#if this.showBranding}}
<div class="login split">
<div class="split__page">
<this.LoginForm class="bright-form bright" />
</div>
</div>
{{else}}
<div class="login centered">
<div class="centered__page">
<this.LoginForm class="bright-form bright" />
</div>
</div>
{{/if}}
Invocation with <this.component/> doesn’t render anything. Is this a bug or am I doing something wrong? Thanks))
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Here is what you need to know about dynamic components in ...
Dynamic template evaluation is of course not the main culprit of AngularJS being viewed as a slow framework, but it certainly contributed to...
Read more >Vue dynamic component template not working for promise
However, the created hook seems to call loader() twice (the second call is unnecessary). That could be simplified:
Read more >MTobisch/ngx-dynamic-hooks - GitHub
Automatically insert live Angular components into dynamic strings (based on their selector or any pattern of your choice) and render the result in...
Read more >Component - Angular
Decorator that marks a class as an Angular component and provides configuration metadata ... If provided, do not supply a template file using...
Read more >Vue dynamic component should have a ... - Rule | DeepScan
If a dynamic component does not have an is attribute, Vue considers it as an unknown custom element. If a dynamic component has...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah it’s already possible to use webpack-dev-server which provides hot reloading by the default. But it requires a bunch of mucking around. Work is underway to package that up and document it.
I was using ember-ast-hot-reload at the same time, removing the package fixed the issue, thanks))