简体   繁体   English

无法在子路径上托管 Storybook

[英]Unable to host Storybook on subpath

I have a storybook for my react components, and when trying to host the static build of story book at root path (ie: https://some-domain.com/ ), then the storybook works fine.我的 React 组件有一本故事书,当尝试在根路径(即: https://some-domain.com/ )托管故事书的静态构建时,故事书工作正常。 However, when trying to host at a sub path such as https://some-domain.com/subpath I get error below from console.但是,当尝试在诸如https://some-domain.com/subpath 之类的子路径上托管时,我从控制台收到以下错误。

Uncaught SyntaxError: Invalid regular expression: /[ªµºÀ-°-ʹͶͷͺ-
ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ -Öˆ×-תׯ-ײؠ-يٮٯٱ-Û“Û•Û¥Û¦Û®Û¯Ûº-Û¼Û¿ÜÜ’-ܯÝ-ޥޱߊ-ߪß
´-ঀঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽৎড়à§à§Ÿ-à¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-
ੜਫ਼ੲ-ੴઅ-àªàª-ઑલଳଵ-ହଽଡ଼à­à­Ÿ-ୡୱஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-
பம-ஹà¯à°…-ఌఎ-à°à°’-నప-హఽౘ-ౚౠౡಀಅ¸²à¸³à¹€-ๆàºàº‚ຄຆ-ຊຌ-ຣລວ-
àï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ï¿—ï
¿š-ï¿œ]/: Range out of order in character class
    at new RegExp (<anonymous>)
    at Module.<anonymous> (vendors~main.ba0ee86f12448108b672.bundle.js:1)
    at Module.ia (ruxitagentjs_ICA2SVfgjqru_10201200909073022.js:308)
    at __webpack_require__ (runtime~main.ba0ee86f12448108b672.bundle.js:1)
    at Object.<anonymous> (vendors~main.ba0ee86f12448108b672.bundle.js:1)
    at Object.ia (ruxitagentjs_ICA2SVfgjqru_10201200909073022.js:308)
    at __webpack_require__ (runtime~main.ba0ee86f12448108b672.bundle.js:1)
    at Object.<anonymous> (vendors~main.ba0ee86f12448108b672.bundle.js:1)
    at Object.ia (ruxitagentjs_ICA2SVfgjqru_10201200909073022.js:308)
    at __webpack_require__ (runtime~main.ba0ee86f12448108b672.bundle.js:1)

Base on what I understand, it seems like SB is trying to find some script at the root path instead of subpath, and since the static folder is served under the subpath, it won't be able to find what it's looking for in the root bath.根据我的理解,似乎 SB 试图在根路径而不是子路径中找到一些脚本,并且由于静态文件夹是在子路径下提供的,因此它将无法在根路径中找到它要查找的内容浴。 Do correct me on this if I'm wrong.如果我错了,请纠正我。 After some googling, I tried modifying the tag in the iframe.html file to have src pointed to the subpath but that doesn't seem to help either.经过一番谷歌搜索后,我尝试修改 iframe.html 文件中的标签,让 src 指向子路径,但这似乎也无济于事。 Can someone help me on this please?有人可以帮我吗?

You can set the publicPath in iframe-webpack-config.js which should solve your issue.您可以在iframe-webpack-config.js设置publicPath这应该可以解决您的问题。

I have found the solution here .我在这里找到了解决方案。 You can checkout that tread for more information.您可以查看该踏板以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM