Dor*_*Dor 2 typescript reactjs webpack ts-loader webpack-4
我已从 Webpack 3 升级到 Webpack 4。\n从那时起,我收到了很多有关未从某些文件导出的导入的警告。
\n\n./packages/utils/logging/index.ts\nAttempted import error: \xe2\x80\x98Options\' is not exported from \'./loggers/log\'.\n @ ./packages/utils/index.ts\n @ ./src/App.tsx\n @ multi whatwg-fetch @babel/polyfill ./src/App.tsx\nRun Code Online (Sandbox Code Playgroud)\n\n我ts-loader与一起使用ForkTsCheckerWebpackPlugin使用。\n我已经检查了警告的导出,它们看起来不错。该代码确实有效,但是我仍然收到这些警告。
tsconfig.json以供参考:
{\n "compilerOptions": {\n "outDir": "build/dist",\n "module": "esnext",\n "target": "es5",\n "lib": ["es6", "dom"],\n "baseUrl": ".",\n "sourceMap": true,\n "allowJs": true,\n "jsx": "react",\n "moduleResolution": "node",\n "forceConsistentCasingInFileNames": true,\n "noImplicitReturns": true,\n "noImplicitThis": true,\n "strictNullChecks": true,\n "suppressImplicitAnyIndexErrors": true,\n "noUnusedLocals": false,\n "noUnusedParameters": false,\n "allowSyntheticDefaultImports": true,\n "skipLibCheck": true,\n "resolveJsonModule": true\n },\n "include": ["packages/**/*"],\n "exclude": [\n "node_modules",\n "build",\n "scripts",\n "webpack",\n "**/__tests__/*"\n ]\n}\n\nRun Code Online (Sandbox Code Playgroud)\n\n网页包配置:
\n\n...\nmodule: {\n rules: [\n {\n test: /\\.(ts|tsx|d.ts)$/,\n exclude: /node_modules/,\n use: {\n loader: \'ts-loader\',\n options: {\n transpileOnly: true,\n },\n },\n },\n {\n test: /\\.(js|jsx|mjs)$/,\n include: [paths.packagesSrc, ...paths.modulesToTranspile],\n exclude: /node_modules/,\n use: {\n loader: \'babel-loader?cacheDirectory=true\',\n options: {\n configFile: paths.configFiles.babel,\n },\n },\n },\n ...\n ]\n},\nplugins: [\n ...\n new ForkTsCheckerWebpackPlugin({\n async: options.asyncTypeChecking,\n checkSyntacticErrors: true,\n tsconfig: paths.appTsConfig,\n watch: paths.packagesSrc,\n }),\n ...\n],\n...\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
6407 次 |
| 最近记录: |