示例回购https://github.com/github0013/typescript_react
我需要加载嵌入到 tag中的 base64 字符串中的图像,但导入图像文件会引发此错误。
TS2307:找不到模块“./Octocat.jpg”。
https://github.com/github0013/typescript_react/commit/6670f3ca74404007ad1ed6e4ab0d111f547ee75d
我对 typescript、webpack 和 react 还很陌生,我确信我对import
typescript 和 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;