无法使用react和phoenix导入jpg文件

时间:2019-05-24 12:36:40

标签: reactjs webpack elixir phoenix-framework webpack-2

我试图在我的反应代码中使用一些图片

import stepper1 from '../assets/static/HomePage/stepper1.png'

但是在服务器运行时出现此错误:

ERROR in ./js/components/assets/static/HomePage/card11.jpg
Module parse failed: Unexpected character 'ي┐╜' (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ ./js/components/_components/HomeCards.js 29:0-60 83:15-23
 @ ./js/components/HomePage/HomePage.js
 @ ./js/components/HomePage/index.js
 @ ./js/app.js
 @ multi ./js/app.js

1 个答案:

答案 0 :(得分:1)

这是因为Web Pack需要文件大声处理才能使用this link处理具有大小的图像。