Create react app, build with relative directories

2019-08-23 11:12发布

In my CRA when I do an "npm run build" it creates a bundle file index.html that has links that look like:

link href="/static/css/main.ef6ca77b.css"

But I don't want it to refer to absolute directories. I'd like for it to use relative directories like:

link href="static/css/main.ef6ca77b.css"

(so without that initial slash...)

Is this possible? The reason I'm asking is I'm deploying multiple apps to a directory and they need refer to their resources relatively and not absolutely...

1条回答
手持菜刀,她持情操
2楼-- · 2019-08-23 12:09

Had to add:

 "homepage": "./"

to package.json

查看更多
登录 后发表回答