我使用创建了一个新的反应项目npx create-react-app app-name --template typescript,它运行良好,直到我导入另一个.tsx文件。现在,当我尝试导入另一个.tsx文件时,出现错误:Module not found: Error: Can't resolve './components/component' in '/Users/benbaldwin/Desktop/project/frontend/teacher/src'
我做的唯一与平常不同的是文件结构。由于我的文件夹中有多个frontend共享依赖项的反应项目,因此我将 移动到node_modules覆盖所有这些子目录。我的文件结构如下所示:
- frontend
- node_modules
- project-1
- public
- src
index.tsx
react-app-env.d.ts
- components
component.tsx
- project-2
package.json
tsconfig.json
Run Code Online (Sandbox Code Playgroud)
组件文件如下所示:
- frontend
- node_modules
- project-1
- public
- src
index.tsx
react-app-env.d.ts
- components
component.tsx
- project-2
package.json
tsconfig.json
Run Code Online (Sandbox Code Playgroud)
索引文件如下所示:
import React from 'react';
const Component: React.FC = () => {
return <div>hello</div>;
}; …Run Code Online (Sandbox Code Playgroud) 我正在使用 firebase 构建一个应用程序,需要在内部 url 下加载外部网页,即当您访问 myapp.com/edit 时,它会请求来自 someotherapp.com/edit 的内容,并将其呈现在浏览器中而不进行重定向。我尝试过使用 firebase 托管重写,但您只能重写到内部 url 或云函数。
我正在使用 flutter hooks 包在屏幕上对元素进行动画处理,但显然我做错了一些事情,因为该元素没有重建为动画。这是我的代码。
class Ball extends HookWidget {
@override
Widget build(BuildContext context) {
final xController = useAnimationController(
duration: Duration(seconds: 3),
lowerBound: 0,
upperBound: 2,
initialValue: 1,
);
final yController = useAnimationController(
duration: Duration(seconds: 3),
lowerBound: 0,
upperBound: 2,
initialValue: 1,
);
useEffect(() {
xController.repeat(reverse: true);
yController.repeat(reverse: true);
return () {};
});
return Align(
alignment: Alignment(
xController.value - 1,
yController.value - 1,
),
child: Container(
width: 12,
height: 12,
decoration: BoxDecoration(
color: Colors.grey[900],
shape: BoxShape.circle,
),
),
);
}
} …Run Code Online (Sandbox Code Playgroud) dart flutter flutter-dependencies flutter-animation flutter-hooks