Storybook: Make absolute path for dlls relative

Created on 20 Dec 2018  路  11Comments  路  Source: storybookjs/storybook

The dlls are loaded as dlls: ['/sb_dll/storybook_ui_dll.js'] in @storybook/core/src/server/manager/manager-webpack.config.js, but if you're serving static files outside of the root directory, this will fail. This should hopefully be something relative, like dlls: ['sb_dll/storybook_ui_dll.js'] or dlls: ['./sb_dll/storybook_ui_dll.js']

Ex: I have a node server stood up on localhost:4000, serving from ./public. I change my storybook output directory to ./public/storybook. The files are created, and loading localhost:4000/storybook serves the page, but requests localhost:4000/sb_dll/storybook_ui_dll.js, which doesn't exist. With relative pathing, it would request as localhost:4000/storybook/sb_dll/storybook_ui_dll.js, which would resolve correctly.

bug core

Most helpful comment

Mind giving this a try and letting me know if it works for you? If so, I\'ll cherry-pick this back to master and do a patch release. Thanks!

@cmwhiting @mysticatea @alex996 @ozio @asychev @Chariyski @baohouse @benjablanko @gpincheiraa @Stevo14850 @unindented @liss-mouse @vio @Pluzu @lauriejones @yhuard @johnhunter @heavenshell @dkimura @dangerdespain @ndelangen

All 11 comments

Same problem. We have a several environments and want to put storybooks to each of them as a subfolder, but we can't because of that absolute path. Had tried to change publicPath in webpack config, but it works only for paths in iframe.html.

Same problem here!

I'm also affected by this. In my case, I'm publishing to GitHub Pages, which are always https://<user>.github.io/<project>/, so storybook_ui_dll.js can never be found.

Same problem here

+1, I'm affected by this as well

For anyone else running across this, here's a build command that should fix this temporarily

{
  "scripts" : {
    "build-storybook": "rm -rf storybook-static && build-storybook && sed -i -e 's/\\\/sb_dll/sb_dll/g' storybook-static/index.html"
  }
}

I'm going to fix this ASAP

Boo-yah!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.0-alpha.1 containing PR #5238 that references this issue. Upgrade today to try it out!

Because it's a pre-release you can find it on the @next NPM tag.

Mind giving this a try and letting me know if it works for you? If so, I\'ll cherry-pick this back to master and do a patch release. Thanks!

@cmwhiting @mysticatea @alex996 @ozio @asychev @Chariyski @baohouse @benjablanko @gpincheiraa @Stevo14850 @unindented @liss-mouse @vio @Pluzu @lauriejones @yhuard @johnhunter @heavenshell @dkimura @dangerdespain @ndelangen

Already. Can confirm that new path is relative: ./sb_dll/storybook_ui_dll.js instead of /sb_dll/storybook_ui_dll.js.

Whoopee!! I just released https://github.com/storybooks/storybook/releases/tag/v4.1.9 containing PR #5238 that references this issue. Upgrade today to try it out!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oriSomething picture oriSomething  路  3Comments

purplecones picture purplecones  路  3Comments

tomitrescak picture tomitrescak  路  3Comments

wahengchang picture wahengchang  路  3Comments

rpersaud picture rpersaud  路  3Comments