• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    해결됨

workspace/channel 새로고침 오류

23.04.21 18:20 작성 조회수 359

0

http://localhost:3090/workspace/channel

http://localhost:3090/ 로 접근해서 해당 path까지 접근이 잘되지만 이후 새로고침하면 자바스크립트를 불러오지 못하여 에러가 납니다.

<body>
    <div id="app"></div>
 
</body>
//에러코드
Rfused to apply style from 'http://localhost:3090/workspace/public/client-boot-styles.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
GET http://localhost:3090/workspace/public/slack-icons-v2-fe043a5.woff2 net::ERR_ABORTED 404 (Not Found)
GET http://localhost:3090/workspace/dist/app.js net::ERR_ABORTED 404 (Not Found)
Rfused to execute script from 'http://localhost:3090/workspace/dist/app.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
GET http://localhost:3090/workspace/public/favicon.ico 404 (Not Found)

the resource http://localhost:3090/workspace/public/slack-icons-v2-fe043a5.woff2 was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.

제 생각에는 http://localhost:3090/workspace/ router가 없어서 channel까지 오지 못하고 중간에서 끊기는 것 같은데

      <Routes>
        <Route path="/" element={<Navigate to="/signin" replace />} />
        <Route path="/signin" element={<SignInPage />} />
        <Route path="/signup" element={<SignUpPage />} />
        <Route path="/workspace" element={<Navigate to="/workspace/channel" replace />} />
        <Route path="/workspace/channel" element={<ChannelPage />} />
      </Routes>

workapce경로에서 channel로 redirect를 걸어주려고 하는데 잘 되지 않습니다

어떻게 개선하면 좋을까요?

답변 2

·

답변을 작성해보세요.

0

grs0412님의 프로필

grs0412

질문자

2023.04.21

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta
      name="viewport"
      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
    />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>Sleact</title>
    <style>
      html,
      body {
        margin: 0;
        padding: 0;
        overflow: initial !important;
      }
      body {
        font-size: 15px;
        line-height: 1.46668;
        font-weight: 400;
        font-variant-ligatures: common-ligatures;
        -moz-osx-font-smoothing: grayscale;
        -webkit-font-smoothing: antialiased;
      }
      * {
        box-sizing: border-box;
      }
    </style>
    <link
      rel="shortcut icon"
      href="
    ./public/favicon.ico"
    />
    <link rel="stylesheet" href="./public/client-boot-styles.min.css" crossorigin="anonymous" />
    <link href="./public/slack-icons-v2-fe043a5.woff2" rel="preload" as="font" crossorigin="anonymous" />
    <script src="./dist/app.js" defer></script>
  </head>
  <body>
    <div id="app"></div>
  </body>
</html>

css 랑 폰트 직접 다운로드해서 넣어두려고 조금 수정했습니다

경로가 ./라서 그렇습니다. spa에서 index.html은 무조건 /로 시작해야 합니다.

grs0412님의 프로필

grs0412

질문자

2023.04.21

/로 수정하니 해결됬습니다
빠른 답변 감사합니다.

0

웹팩 컨텐츠들의 경로문제이고요. index.html을 수정하신 적이 있나요? 일단 저 파일들을 왜 불러오는지를 모르겠네요.

라우터 문제가 아니니 라우터는 손대지 마세요. 다 고장납니다.