// src/index.js// 이미지 파일 가져오기import mainImage from"./assets/image.jpg";// DOM을 통해 img 태그 src 속성에 이미지 파일 넣기const img = document.getElementById("mainImage");
img.src = mainImage;
- 빌드 에러 발생
npm run build 명령어 실행 시, 에러 발생
이미지 파일 타입을 사용하기 위해 적절한 로더가 필요하다는 에러 메세지가 표시됨
ERROR in ./src/assets/image.jpg 1:0
Module parse failed: Unexpected character '�'(1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders(Source code omitted for this binary file)
@ ./src/index.js 4:0-43 8:10-19
webpack 5.90.3 compiled with 1 error in1100 ms