更改版本后获取JS错误:未定义XYZ
我正在使用React-Vis库。他们的读书文件说:
如果您在非节点环境中工作,也可以使用基本的HTML标签直接包含捆绑包和编译样式。
< link rel =“ stylesheet” href =“ https://unpkg.com/react-vis/dist/style.css”> < script type =“ text/javascript” src =“ https://unpkg.com/react-vis/dist/dist/dist.min.js”></script>
全局
reactvis
对象现在可以供您玩。
当我做到这一点时,它可以正常工作,并且我能够在代码中使用reactvis
对象。它链接版本 1.11.7
来自> umpkg
。我想尝试版本
1.11.5
。因此,我尝试了以下内容:
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/style.css">
<script type="text/javascript" src="https://unpkg.com/browse/[email protected]/dist/dist.min.js"></script>
但是,现在它给了我以下错误:
Uncaught ReferenceError: reactVis is not defined
某种程度上,它无法引用reactvis
代码。为什么这样?
I was using react-vis library. Their readme file says following:
If you're working in a non-node environment, you can also directly include the bundle and compiled style using basic html tags.
<link rel="stylesheet" href="https://unpkg.com/react-vis/dist/style.css"> <script type="text/javascript" src="https://unpkg.com/react-vis/dist/dist.min.js"></script>
The global
reactVis
object will now be available for you to play around.
When I do exactly that, it works and I was able to use reactVis
object in my code. It links versions 1.11.7
from unpkg
. I wanted to try out version 1.11.5
. So, I tried following:
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/style.css">
<script type="text/javascript" src="https://unpkg.com/browse/[email protected]/dist/dist.min.js"></script>
But, now it gives me following error:
Uncaught ReferenceError: reactVis is not defined
Somehow, it is not able to get reference to reactVis
code. Why is this so?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的链接包含
https://unpkg.com/browse/...
/browse
链接到该文件的HTML预览页。链接到文件的原始版本remove
/browse
在您的情况下https://unpkg.com/ [email&nbsp; procented] /dist/dist/dist.min.js
,链接到文件原始的文件。例如。
The link you used contains
https://unpkg.com/browse/...
/browse
links to the html preview page of the file.To link to the raw version of the file remove
/browse
in your case tohttps://unpkg.com/[email protected]/dist/dist.min.js
, which would link to the file raw.eg.