Just upgraded from 5.4 to 5.8. Now I’m getting this error.
\src\node_modules\.embroider\rewritten-app\routes\components\case-tools\template.hbs:
Unsafe dynamic component: this.tool in
node_modules\.embroider\rewritten-app\routes\components\case-tools\template.hbs
I found only one link so far that discusses how to set up an exception for ‘component’. But I don’t understand what it’s asking me to do.
I’ve tried variations on these values for packageRules. With these values it tells me that it can’t parse “component”.
What do the various values in packageRules mean, and where do I find what to shove into them?
packageRules
const { Webpack } = require('@embroider/webpack');
return require('@embroider/compat').compatBuild(app, Webpack, {
...
packageRules: [
{
package: '@glimmer/component',
components: {
'component': {
acceptsComponentArguments: ['this.tool'],
layout: {
addonPath: 'app\routes\components\case-tools\component.hbs',
},
},
},
},
],
template.hbs
<div class="ml-auto flex float-right">
{{!-- Tools --}}
{{#if this.tool}}
<div class="absolute right-24">
<div>{{component this.tool caseId=@caseId}}</div>
</div>
{{/if}}
{{!-- Tool bar --}}
<div class="bg-slate-400 ml-auto p-2">
<button {{on "click" (fn this.toggleTool "case-note" )}}
class=" text-slate-600 hover:text-white hover:bg-slate-300 group flex gap-x-3 rounded-md p-3 text-sm leading-6 font-semibold"
type="button" id="btnCaseListNavBarCaseNote">
<Bui::Icon class="w-8 h-8" @icon="sticky-note" />
</button>
</div>
</div>
component.js
export default class CaseToolsComponent extends Component {
@tracked tool = ""
@action toggleTool(toolName) {
if (this.tool == toolName) {
this.tool = ""
} else {
this.tool = toolName
}
}
}