inflearn logo
강의

講義

知識共有

Slackクローンコーディング[Reactによるリアルタイムチャット]

Babel と webpack の 設定

path에러가 납니다.ㅠㅠ

1213

ryosuke kureha

投稿した質問数 13

0

[webpack-cli] Failed to load '/Users/ohyunseok/Documents/PROJECT/Slacku/react-frontend/webpack.config.ts' config
[webpack-cli] webpack.config.ts:1:8 - error TS1259: Module '"path"' can only be default-imported using the 'esModuleInterop' flag

1 import path from 'path';
         ~~~~

  node_modules/@types/node/path.d.ts:162:5
    162     export = path;
            ~~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
webpack.config.ts:1:8 - error TS1259: Module '"path"' can only be default-imported using the 'esModuleInterop' flag

1 import path from 'path';
         ~~~~

  node_modules/@types/node/path.d.ts:162:5
    162     export = path;
            ~~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.
webpack.config.ts:3:8 - error TS1259: Module '"/Users/ohyunseok/Documents/PROJECT/Slacku/react-frontend/node_modules/webpack/types"' can only be default-imported using the 'esModuleInterop' flag

3 import webpack, { Configuration as WebpackConfiguration } from 'webpack';
         ~~~~~~~

  node_modules/webpack/types.d.ts:12245:1
    12245 export = exports;
          ~~~~~~~~~~~~~~~~~
    This module is declared with using 'export =', and can only be used with a default import when using the 'esModuleInterop' flag.

error Command failed with exit code 2.

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

回答 5

0

ryosuke kureha

ㅠㅠ

0

ryosuke kureha

App.tsx:12 Uncaught ReferenceError: $RefreshReg$ is not defined

    at Object../layouts/App.tsx (App.tsx:12)

    at __webpack_require__ (bootstrap:19)

    at app.js:29889

    at app.js:29894

    at app.js:29895

./layouts/App.tsx @ App.tsx:12

__webpack_require__ @ bootstrap:19

(anonymous) @ app.js:29889

(anonymous) @ app.js:29894

(anonymous) @ app.js:29895

index.html:73 

0

zerocho

webpack.config.ts 문제입니다

0

ryosuke kureha

{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "Node",
"target": "es5",
"esModuleInterop": true
}
}
tsconfig-for-webpack-config.json 문제였습니다.

0

ryosuke kureha

제초로님 칼답장 감사합니다. 언제나 팬입니다.

페이스북 친구추가 받아주셔서 감사합니다. 

해결 했습니다.

0

zerocho

제 깃헙에 있는 package.json 버전과 똑같이 맞추세요. settings/ts 폴더를 그대로 복붙해서 쓰시는 게 가장 좋습니다.

기본 셋팅과 관련하여

0

93

1

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

0

97

2

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

0

150

2

useEffect 개수 관리

0

111

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

179

2

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

0

157

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

992

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