【发布时间】:2018-04-27 05:34:58
【问题描述】:
我使用 Node.js + Typescript 和 React+ Typescript 构建全栈应用程序。 文件夹结构:
App
-node_modules //server part's dependencies
-build //includes compiled server code
-src
-server
-client
-node_modules //client part's dependencies
tsconfig.json //created by 'create-react-app'
package.json //created by 'create-react-app'
tsconfig.json
tslint.json
package.json // includes config for server compiling and running
所以,当我执行命令tsc && node build/www 时,服务器启动。
但如果我想使用命令react-scripts-ts start 构建反应包,我会收到不属于反应项目的错误。例如:
Failed to compile.
~/projects/App/node_modules/@types/graphql/execution/execute.d.ts
(1,44): Cannot find module '../error'.
为什么 react-scripts-ts 会在 non-react 文件夹中查找依赖项?
【问题讨论】:
标签: node.js reactjs typescript single-page-application react-fullstack