【发布时间】:2017-11-19 13:54:11
【问题描述】:
示例回购https://github.com/github0013/typescript_react
我需要加载base64字符串嵌入标签中的图像,但是导入图像文件会引发此错误。
TS2307:找不到模块“./Octocat.jpg”。
https://github.com/github0013/typescript_react/commit/6670f3ca74404007ad1ed6e4ab0d111f547ee75d
我对 typescript、webpack 和 react 还是很陌生,我确信我对 typescript 的 import 和 webpack 感到困惑。
如何为图片启用url-loader?这甚至有效吗?
https://github.com/github0013/typescript_react/blob/master/config/webpack/environment.js
--
我确实尝试过require,但它只会返回图像的路径而不是base64搅拌。
// global.d.ts
declare function require(string): string;
【问题讨论】:
标签: ruby-on-rails reactjs typescript webpack webpacker