강의

멘토링

커뮤니티

Inflearn コミュニティ Q&A

ohhayocom5954 のプロフィール画像
ohhayocom5954

投稿した質問数

Slack クローン コーディング [React を使用したリアルタイム チャット]

Babel と webpack の 設定

path에러가 납니다.ㅠㅠ

作成

·

1.2K

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.
reactSocket.iotypescript웹팩babel클론코딩

回答 5

0

ㅠㅠ

0

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 

zerocho님의 프로필 이미지
zerocho
インストラクター

webpack.config.ts 문제입니다

0

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

0

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

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

해결 했습니다.

0

zerocho님의 프로필 이미지
zerocho
インストラクター

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

ohhayocom5954 のプロフィール画像
ohhayocom5954

投稿した質問数

質問する