SI: Vue 3 Attempts to load JavaScript file from wrong location when using Vue Router lazy loading.
Closed this issue · 0 comments
Sponsorship
If this request requires additional support (e.g., such as direct email/phone/meeting/development), I have the following interest in helping to sponsor the effort via GitHub Sponsors:
- None, please continue to work for me for free :P
- Absolutely, I get value out of this!
- Maybe later
- I'm already a sponsor... Woot!
Describe the bug
When using the Vue Router lazy loading feature (https://router.vuejs.org/guide/advanced/lazy-loading.html) the module tries to load the JavaScript from the wrong URL.
Given a router.js
file like
when a <RouterLink>
to the ItemDetail
route on the HomeItem
component is clicked the application tries to load a JavaScript chuck from /js/src_component_ItemDetail_vue.js
.
The component chuck is correctly created in the build process and stored in the correct location /DesktopModules/<modulename>/scripts/client-app/js/src_component_ItemDetail_vue.js
.
Software Versions
- DNN: 09.13.01 (0)
- Visual Studio: 2022
To Reproduce
Steps to reproduce the behavior:
- Create simple "details" component
- Add a route to the
router.js
file to the component. Something the description above. - Add a
<RouterLink>
to theHomeItem
component that links to the new component. - Follow the link from the main page.
- See the browser developer networking tab or console for error.
Expected behavior
I expect the application to properly load the JavaScript chuck and display the ItemDetail
component.
Actual behavior
Does not load because the request returns a 404 as it is using the incorrect URL.
Screenshots
Error log
ChunkLoadError: Loading chunk src_components_ItemDetails_vue failed. vue-router.mjs:3256
Additional context
Add any other context about the problem here.