• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    미해결

path에러가 납니다.ㅠㅠ

21.06.16 00:16 작성 조회수 688

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.

답변 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 

webpack.config.ts 문제입니다

0

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

0

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

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

해결 했습니다.

0

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