jsakamoto / BlazingStory

The clone of "Storybook" for Blazor, a frontend workshop for building UI components and pages in isolation.
https://jsakamoto.github.io/BlazingStory/
Mozilla Public License 2.0
317 stars 15 forks source link

iframe.html imports not found when deployed #56

Closed NathanVG closed 1 month ago

NathanVG commented 1 month ago

I am trying to deploy our blazing story project internally, the publish works fine but all the components break due to not finding the imports in iframe.html i.e. <script src="_framework/blazor.webassembly.js"></script>

Shoud the paths be built differently?

jsakamoto commented 1 month ago

Hi @NathanVG, What is the root URL you deployed your Blazing Story app to? Is it http://server/, http://server/appname/, or something similar? Generally, hosting a Blazor application under a sub-path URL requires some additional tasks to publish.

See also: https://learn.microsoft.com/aspnet/core/blazor/host-and-deploy/#app-base-path

jsakamoto commented 1 month ago

Hi @NathanVG, You may need to rewrite the href attribute of the <base/> tag in the iframe.html. If your app is in the URL http://server/foo/bar, you should rewrite it from / to /foo/bar/. Please keep in mind that a trailing slash is required.

<!-- wwwroot/iframe.html -->
<!DOCTYPE html>
<html lang="en">

<head>
    ...
    <base href="/foo/bar/" /> <!-- 👈 rewrite this one! -->
    ...
NathanVG commented 1 month ago

Hi @jsakamoto,

this indeed fixed the issue, didn't consider the fact I'd have to do it for the iframe as well. Thank you!