Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 在Next.js 9.1.1版中的tsx文件中找不到.less模块_Reactjs_Typescript_Next.js - Fatal编程技术网

Reactjs 在Next.js 9.1.1版中的tsx文件中找不到.less模块

Reactjs 在Next.js 9.1.1版中的tsx文件中找不到.less模块,reactjs,typescript,next.js,Reactjs,Typescript,Next.js,我正在使用带有Typescript和@zeit/Next less的Next.js 9.1.1版。每次我在tsx文件中导入较少的文件时,都会显示此错误 此错误不会导致我的生成出现任何问题。样式在开发和生产过程中正确导入 我应该如何解决此错误?我应该如何告诉Typescript导入.less文件? 我使用了externals.d.ts文件,但似乎不起作用。 我的tsconfig.json文件如下所示- { "compilerOptions": { "module": "esnext"

我正在使用带有Typescript和@zeit/Next less的Next.js 9.1.1版。每次我在tsx文件中导入较少的文件时,都会显示此错误

此错误不会导致我的生成出现任何问题。样式在开发和生产过程中正确导入

我应该如何解决此错误?我应该如何告诉Typescript导入.less文件? 我使用了externals.d.ts文件,但似乎不起作用。 我的tsconfig.json文件如下所示-

{
  "compilerOptions": {
    "module": "esnext",
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "checkJs": false,
    "strict": false,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve"
  },
  "exclude": ["node_modules", "**/*.js", "**/*.jsx"],
  "include": ["externals.d.ts", "next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
declare module '*.less' {
  const content: any;
  export default content;
}
我的externals.d.ts文件如下所示-

{
  "compilerOptions": {
    "module": "esnext",
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "checkJs": false,
    "strict": false,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve"
  },
  "exclude": ["node_modules", "**/*.js", "**/*.jsx"],
  "include": ["externals.d.ts", "next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
declare module '*.less' {
  const content: any;
  export default content;
}