Node.JS is a server-side technology, not a browser technology. Thus, Node-specific calls, like require(), do not work in the browser.
See browserify or webpack if you wish to serve browser-specific modules from Node.
但是你可以使用,以使得该按钮的步骤...
Usage:
- Place this tag where you want the button to render
<a class="github-button" href="https://github.com/microsmsm" data-
size="large" aria-label="Follow @microsmsm on GitHub">Follow
@microsmsm</a>
- Place this tag in your head or just before your close body tag
<script async defer src="https://buttons.github.io/buttons.js"></script>
代码示例:
https://codepen.io/Microsmsm/pen/NvJaNm?editors=1100
参考:
https://buttons.github.io/
你正在使用什么框架/库?即:角度,反应或vue? – Microsmsm
纯JavaScript,但我最近包括require.js并且不起作用。 @Microsmsm –