找不到模块 '!!raw-loader!./something.glsl' 或其相应的类型声明

问题描述

我有一个使用 create-react-app --template 打字稿启动的项目。我需要使用 webpack raw-loader 导入一些文件,所以我做了一个 npm i -D raw-loader。现在我像这样导入那些:

// eslint-disable-next-line import/no-webpack-loader-Syntax
import fSrc from '!!raw-loader!./something.glsl';

我为 .glsl 文件添加了声明,并为我的项目添加!raw-loader!

// index.d.ts

declare module '*.svg';
declare module '*.glsl';
declare module '!raw-loader!*';

但是,我收到编译器错误

Cannot find module '!!raw-loader!./something.glsl' or its corresponding type declarations.  TS2307

    1 | // eslint-disable-next-line import/no-webpack-loader-Syntax
  > 2 | import fSrc from '!!raw-loader!./something.glsl';

在这里做错了什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)