【发布时间】:2018-10-07 04:13:10
【问题描述】:
遵循文档here (Building for Relative Paths),因此在 package.json 中设置主页字段不会在构建期间设置 PUBLIC_URL。
预期行为
build/index.html 中的%PUBLIC_URL% 应替换为 package.json 主页字段中设置的 URL。
package.json:
"homepage": "https://example.com",
构建/index.html:
<script type="text/javascript" src="https://example.com/static/js/main.ec7f8973.js">
实际行为
<script type="text/javascript" src="/static/js/main.ec7f8973.js">
%PUBLIC_URL% 将被替换为空。
【问题讨论】:
-
@AliAnkarali 我已经看到了。但这不是我要找的。无论如何,谢谢。
标签: reactjs webpack package.json