Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Pascal van Oostenbrugge 1 post 71 karma points
    Oct 17, 2022 @ 11:12
    Pascal van Oostenbrugge
    0

    Lit webcomponent backoffice page loads script from /umbraco

    I have been working on creating a backoffice package using the new Umbraco UI with Lit and webcomponents. https://umbraco.com/blog/umbraco-ui-library-release/

    After generatingwith open-rc and bundling and inserting the .html and .js files I can see the page in the backoffice. The javacript file however, is failing to load as https://hostname/umbraco.

    It looks like Angular doesn't respect the base href option anymore. When I load the html page directly in another tab, everything works fine.

    Right now my nuget package build targets also copies the javascript file to wwwroot/umbraco, but this is just a temporary workaround.

    Any clues on how I can have the javascript file loaded as well from my app-plugins package folder?

    This is my Index.html now:

    <!doctype html>
    <html lang="en">
    
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
      <meta name="Description" content="Put your description here.">
      <base href="/">
      <title>test-ui</title>
    </head>
    
    <body>
      <test-ui></test-ui>
      <script type="module" src="./7cba728f.js"></script>
      <script
        inject-service-worker="">"serviceWorker" in navigator && window.addEventListener("load", (function () { navigator.serviceWorker.register("sw.js").then((function () { console.log('ServiceWorker registered from "sw.js".') })).catch((function (e) { console.log("ServiceWorker registration failed: ", e) })) }))</script>
    </body>
    
    </html>
    

    Lit generates this Index, I have tried to figure out how I can adjust the output <script type="module" src="./7cba728f.js"></script>" but haven't found anything yet.

Please Sign in or register to post replies

Write your reply to:

Draft