Storybook: Problem to configure <base> to let storybook access statics in a subdirectory

Created on 2 Mar 2020  路  4Comments  路  Source: storybookjs/storybook

Describe the bug
I expose storybook behind a subpath on my website : /storybook/
So, as suggested in the doc for absolute path usage, I've tried to use <base> HTML element to define the base path of my statics

This is also mentionned in https://github.com/storybookjs/storybook/issues/7775

But, if the <base> element work well in manager-head.html to change the base path for scripts, it seems totally useless for cases like <img src="/assets/my_img.png">

Note :
I've tried in manager-head.html and preview-head.html, with various base combinations with the various target available

System:

Environment Info:

  System:
    OS: Linux 5.5 Fedora 31 (Workstation Edition) 31 (Workstation Edition)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  Binaries:
    Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
    Yarn: 1.22.0 - /usr/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v10.15.3/bin/npm
  Browsers:
    Firefox: 73.0.1
  npmPackages:
    @storybook/addons: ^5.3.12 => 5.3.12 
    @storybook/core: ^5.3.12 => 5.3.12 
    @storybook/react: ^5.3.12 => 5.3.12 
core inactive question / support

Most helpful comment

Stale bots are a pain ...

All 4 comments

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Stale bots are a pain ...

@Nabellaleen were you able to resolve the issue?

I am facing a similar problem with hosting SB in a subfolder while referring to assets in public root folder in my React app - i. e. <img src="/assets/my_img.png">

<base> tag sounds almost like the solution though I think it does not work for absolute paths starting with / so it gets ignored for src="/assets/my_img.png".

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChucKN0risK picture ChucKN0risK  路  74Comments

aericson picture aericson  路  97Comments

maraisr picture maraisr  路  119Comments

joeruello picture joeruello  路  79Comments

tycho01 picture tycho01  路  76Comments