inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

Slack 클론 코딩[실시간 채팅 with React]

워크스페이스 만들기(gravatar)

workspace/channel 새로고침 오류

해결된 질문

583

grs0412

작성한 질문수 18

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를 걸어주려고 하는데 잘 되지 않습니다

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

react 웹팩 typescript socket.io babel 클론코딩

답변 2

0

grs0412

<!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 랑 폰트 직접 다운로드해서 넣어두려고 조금 수정했습니다

0

제로초(조현영)

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

0

grs0412

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

0

제로초(조현영)

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

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

기본 셋팅과 관련하여

0

92

1

초기 셋팅 back과 front만 남겨두고 다 지운 후 진행 방법

0

96

2

focus 시에만 화면 업데이트 되는 이유 + 해결방법

0

150

2

useEffect 개수 관리

0

110

2

라이브러리 서치 방법

0

104

2

함수 정의 패턴

0

77

1

npm run dev 에러

0

152

3

npx webpack 후 에러

0

178

2

'void' 형식 식의 truthiness를 테스트할 수 없습니다.ts(1345)

0

144

2

사용자 가입시 에러발생 (TypeError: Cannot read properties of null (reading 'addMembers')

1

178

2

초기세팅중 packge.json 에러떠요

0

156

2

CORS - Access-Control-Allow-Origin 누락 문제

0

431

3

로그인 페이지 무한 새로고침 현상

0

598

2

Module not found: Error: Can't resolve './App' 에러

0

959

1

배포 방법

0

298

2

npm run dev 시 빌드가 매우 느려졌습니다

0

990

2

alias 경로 설정 오류

0

452

2

fetcher 함수의 data 값이 두번 찍히는 이유

0

278

1

제네릭 질문

0

218

2

ts-node 대신 tsx 사용여부

0

373

1

배포 관련 질문

0

247

1

[nginx + https] 서비스를 실행하면 niginx가 아닌 서비스 화면을 보여주게 하고 싶습니다.

0

385

2

[배포하기] webpack에 aws 퍼블릭 IPv4 주소 와 포트 주소를 작성하고 나서 빌드후 실행하면 오류가 발생합니다.

0

336

1

users 호출 시 쿠키가 담기지 않는 이슈 질문드립니다.

0

247

2