Webpack 오류 해결 (1): ERROR in Entry module not found
ERROR in Entry module not found:
Error: Cannot resolve 'file' or 'directory'
./es6/index.es6 in E:\Workspace\webpack-template
그러나 디렉터리 구조를 반복적으로 비교한 결과'es6/index.es6'가'E:\Workspace\webpack-template'에 있는 것을 발견했지만 왜 끝까지 찾지 못했을까?path를 도입하여 포털 파일을 절대 주소로 변경합니다.
let path = require('path')
module.exports = {
entry: {
index: path.resolve('./es6/index.es6')
}
}
그러나 여전히 같은 오류를 보고합니다. "ERROR in Entry module not found".
설정에 따라 항목별로 제외합니다. 마지막으로resolve 설정 항목과 관련이 있습니다. 기본 설정을 덮어쓰고 extensions에 빈 문자열을 추가해야 합니다. 다음과 같습니다.
resolve: {
// ,
extensions: ['', '.es6']
}
왜 이러지?공식적인 해석은 다음과 같다.
Using this will override the default array, meaning that webpack will no longer try to resolve modules using the default extensions.
For modules that are imported with their extension, e.g. import SomeFile from "./somefile.ext", to be properly resolved, an empty string must be included in the array.
간단하게 말하면 기본 설정을 덮어쓰면 빈 문자열을 추가해야 합니다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
generator-react-webpack이라는 것을 발견했기 때문에 사용해 보았다React 유행하는 것 같지만 무엇을 손에 넣을 수 있는지 잘 모르는 사람 (= 완전히 자신) 되는 것을 발견했기 때문에 readme 등 보면서 조사 조사해 갑니다. 아무 생각 없이 다음을 수행npm install ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.