Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.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 尝试导入错误:“SomeObject”未从文件导出_Reactjs_Typescript_Webpack_Webpack 4_Ts Loader - Fatal编程技术网

Reactjs 尝试导入错误:“SomeObject”未从文件导出

Reactjs 尝试导入错误:“SomeObject”未从文件导出,reactjs,typescript,webpack,webpack-4,ts-loader,Reactjs,Typescript,Webpack,Webpack 4,Ts Loader,我已经从第3页升级到第4页。 从那以后,我收到了很多关于未从某些文件导出的导入的警告 ./packages/utils/logging/index.ts Attempted import error: ‘Options' is not exported from './loggers/log'. @ ./packages/utils/index.ts @ ./src/App.tsx @ multi whatwg-fetch @babel/polyfill ./src/App.tsx 我使

我已经从第3页升级到第4页。 从那以后,我收到了很多关于未从某些文件导出的导入的警告

./packages/utils/logging/index.ts
Attempted import error: ‘Options' is not exported from './loggers/log'.
 @ ./packages/utils/index.ts
 @ ./src/App.tsx
 @ multi whatwg-fetch @babel/polyfill ./src/App.tsx
我使用ts加载器和ForkTsCheckerWebpackPlugin。 我检查了警告中的出口,它们看起来不错。代码确实有效,但是我仍然收到这些警告

tsconfig.json供参考:

{
  "compilerOptions": {
    "outDir": "build/dist",
    "module": "esnext",
    "target": "es5",
    "lib": ["es6", "dom"],
    "baseUrl": ".",
    "sourceMap": true,
    "allowJs": true,
    "jsx": "react",
    "moduleResolution": "node",
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "allowSyntheticDefaultImports": true,
    "skipLibCheck": true,
    "resolveJsonModule": true
  },
  "include": ["packages/**/*"],
  "exclude": [
    "node_modules",
    "build",
    "scripts",
    "webpack",
    "**/__tests__/*"
  ]
}

网页包配置:

...
module: {
    rules: [
      {
        test: /\.(ts|tsx|d.ts)$/,
        exclude: /node_modules/,
        use: {
          loader: 'ts-loader',
          options: {
            transpileOnly: true,
          },
        },
      },
      {
        test: /\.(js|jsx|mjs)$/,
        include: [paths.packagesSrc, ...paths.modulesToTranspile],
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader?cacheDirectory=true',
          options: {
            configFile: paths.configFiles.babel,
          },
        },
      },
      ...
    ]
},
plugins: [
    ...
    new ForkTsCheckerWebpackPlugin({
      async: options.asyncTypeChecking,
      checkSyntacticErrors: true,
      tsconfig: paths.appTsConfig,
      watch: paths.packagesSrc,
    }),
    ...
],
...

在Typescript中重新导出类型时,Webpack 4中的ts loader似乎有问题。 警告可以忽略