react-styleguidist icon indicating copy to clipboard operation
react-styleguidist copied to clipboard

Wrong assets path on build

Open liniquerntconsult opened this issue 4 years ago • 9 comments

Hi, I'm facing an issue. On dev the assets are working great but when I run the build the path of assets is wrong.

the final path is: build/styleguide/static/css/static/media/ico_error.7083826e.svg

build should be build/styleguide/static/media/ico_error.7083826e.svg

This error is occurring on all my assets, icons, and fonts.

liniquerntconsult avatar Aug 14 '20 19:08 liniquerntconsult

I guess I'm glad I'm not the only one. I tried to read through the documentation to see if something was misconfigured, but nothing obvious is missing.

Subterrane avatar Nov 13 '20 23:11 Subterrane

Either of you find a fix for this? Running into same issue with the path to fonts.

tomgenoni avatar Dec 17 '20 00:12 tomgenoni

Kind of. I manually copied the assets that were compiled into the directory it was looking in. If you make any asset changes, you'll have to perform this manual step again.

Subterrane avatar Dec 17 '20 00:12 Subterrane

An easier workaround is to manually set publicPath in the utilized webpack config:

dangerouslyUpdateWebpackConfig(webpackConfig, env) {
    if (!webpackConfig.output.publicPath) {
      webpackConfig.output.publicPath = "/";
    }
    return webpackConfig;
},

stefan-jonasson avatar Jan 22 '21 14:01 stefan-jonasson

Relative paths in styleguidist server and build for fonts src referrals in the css are broken and are missing a slash. url(static/media/... needs to be url(/static/media.... React build and react serve works as expected with the correct relative paths. My styleguidist.cofig.js does not include any path configuration so it should be the same as the React app, correct? What exactly needs to be updated in the styleguidist.cofig.js to fix this? Thanks a lot!

NathanQ avatar Apr 28 '21 15:04 NathanQ

😴 This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week without any further activity. Consider opening a pull request if you still have this issue or want this feature.

stale[bot] avatar Oct 02 '21 02:10 stale[bot]

@stefan-jonasson thank you so much for your suggestion. I love styleguidist but i have been fighting that weird asset path inside the css 😢

otimong avatar Jan 26 '22 15:01 otimong

😴 This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week without any further activity. Consider opening a pull request if you still have this issue or want this feature.

stale[bot] avatar Apr 27 '22 23:04 stale[bot]