실행 한 후 Create React App의 npm run build
는, 생성 된 index.html
은 다음과 같습니다만들 반응 - 응용 프로그램의 CSS와 JS 경로
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>React App</title><link rel="shortcut icon" href="/favicon.ico"><link href="/main.e606e04b6e0092a87205a9dc4662479c.css" rel="stylesheet"></head><body><div id="root"></div><script type="text/javascript" src="/main.35180d284d8a2058f717.js"></script></body></html>
모두, script
및 link
src
/href
-attributes, 잘못된 방향을 가리키고. 모든 생성 된 파일은 동일한 디렉토리에 있으므로 선두 인 /
은 제거해야합니다. 이 버그입니까? 아니면 어떻게 든이 경로를 구성 할 수 있습니까?
이것은 버그가 아닙니다. 그것은 색인의 옆에 다른 노선에 그 특정한 파일을 얻는 는다는 것을 확인합니다 –