require ES3 更新

require 语句在 es3中需要使用.default获取data资源. 语法改变.

ES2 语法:

<img src={require(“./../images/logo192.png”)} alt=”” />

ES3 语法

<img src={require(“./../images/logo192.png”).default} alt=”” />

npm install –save [email protected]^3

Leave a Comment

Your email address will not be published.