【发布时间】:2017-03-01 23:59:58
【问题描述】:
我一直在关注 ui-router-react 文档 (https://ui-router.github.io/react/) 我在导入时遇到了很多关于 webpack 编译我的代码库的问题
import {UIRouter, UIView, UISref, UISrefActive, pushStateLocationPlugin} from 'ui-router-react';
当我收到这些错误时进入 app.tsx:
ERROR in [at-loader] node_modules/ui-router-core/lib/common/common.d.ts:388:31
TS7006: Parameter 'a' implicitly has an 'any' type.
ERROR in [at-loader] node_modules/ui-router-core/lib/common/common.d.ts:388:34
TS7006: Parameter 'b' implicitly has an 'any' type.
ERROR in [at-loader] node_modules/ui-router-core/lib/resolve/resolveContext.d.ts:7:22
TS7005: Variable 'NATIVE_INJECTOR_TOKEN' implicitly has an 'any' type.
ERROR in [at-loader] node_modules/ui-router-core/lib/transition/transitionHook.d.ts:13:37
TS7006: Parameter 'error' implicitly has an 'any' type.
ERROR in [at-loader] src/components/loginComponent.tsx:23:33
TS2314: Generic type 'KeyboardEvent<T>' requires 1 type argument(s).
ERROR in [at-loader] src/components/loginComponent.tsx:32:31
TS2314: Generic type 'KeyboardEvent<T>' requires 1 type argument(s).
我认为在我的 webpack.config.js webpack 中不应该查看 node_modules,但显然它是。
这是分支 reactRouting 下的 repo 链接
https://github.com/JMStudiosJoe/ReactPractice/tree/reactRouting
【问题讨论】:
-
这里的问题太多,无法具体回答。考虑将它们分解成孤立的问题,包括配置和分解组件。
标签: reactjs typescript webpack url-routing