1
我目前的文件夹结构打字稿:多tsconfig.json问题与CommonJS的使用Node.js语言和ES6为reactjs
ts_dev
--client
*components.tsx
*tsconfig.json
--server
*server.ts
*tsconfig.json
--share
*utility.ts
Node.js的服务器需要使用commonjs
模块,以及es2015
为客户端侧面组件。我放置服务器目录下使用这两种客户和服务器的份额文件夹,因为它需要commonJS
对Node.js的
tsconfig.json在服务器:
{
"compilerOptions": {
"module": "commonJS",
"target": "es2015",
"moduleResolution": "node",
"outDir": "../../src",
"lib": ["es6", "dom"],
"types": ["reflect-metadata","system"],
"jsx": "react"
},
"exclude": [
"node_modules",
]
}
tsconfig.json在客户端:
{
"compilerOptions": {
"module": "es2015",
"target": "es2015",
"moduleResolution": "node",
"outDir": "../../src",
"lib": ["es6", "dom"],
"types": ["reflect-metadata","system"],
"jsx": "react"
},
"exclude": [
"node_modules",
]
}
不过,我发现,在share
脚本在ES6始终遵守(使用出口,进口等)而不是commonJS,这打破了我的服务器。我怀疑它是由client
中的tsconfig引起的。我能做些什么来解决这个问题?