You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior:
Module names/ids for custom element html files in the resources/elements directory are being named resource/element/test-element.html even when an elements alias is created for the directory
Steps to recreate
install a new project from the cli.
add a custom element named test-element from the cli.
create an alias for the resources/elements folder in the webpack.config.js:
Uncaught (in promise) Error: Unable to find module with ID: elements/test-element.html
Expected behavior
The moduleId for the html (and probably css) should match the path for the js file--aka it should start with 'elements/', not 'resources/'.
What is the motivation / use case for changing the behavior?
I am porting a large project--hundreds of custom elements and templates living in the elements directory--from requirejs to webpack. For requirejs projects the aurelia.json nicely provides the paths properties to set this up.
The text was updated successfully, but these errors were encountered:
Yeah uh, I've run into fun things like this.
the tldr is that you need to patch it yourself, and it's a pain in the butt.
My work around, I re-wrote the aliased paths in the html-loader preprocessor in webpack. However, this would cause the webpack build to fail as static analysis would fail. So in addition, you need to still alias the files. However, then webpack doesn't BUNDLE the files. Finally, you need to load all the aliases globally using globalResources on the aurelia configuration and then FINALLY at last, your aliases work. (at the cost of the aliases being loaded as global resources).
smh.
This is for y'all that's been waiting two years for this to be fixed. Bless your heart. And I hope you come up with a better hack around this limitation then I did.
We wanted to in our project replace the relative imports, with aliased imports in the component js files using @viewResources() but bumped into this issue as well.
It seems like a previous issue on this was marked as wontfix, so I assume that aliased paths with component imports is basically not supported with aurelia? That's quite a shame.
I'm submitting a bug report
5.0.4
Please tell us about your environment:
Operating System:
OSX 10.16
Node Version:
18.12.0
8.19.2
webpack 5.75.0
Browser:
Chrome 108
Language:
ESNext
Current behavior:
Module names/ids for custom element html files in the
resources/elements
directory are being namedresource/element/test-element.html
even when anelements
alias is created for the directorySteps to recreate
Expected behavior
The moduleId for the html (and probably css) should match the path for the js file--aka it should start with 'elements/', not 'resources/'.
What is the motivation / use case for changing the behavior?
I am porting a large project--hundreds of custom elements and templates living in the elements directory--from requirejs to webpack. For requirejs projects the aurelia.json nicely provides the paths properties to set this up.
The text was updated successfully, but these errors were encountered: