New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use composite
tsconfig.json setting
#7147
Comments
This is not a bug report, it's a feature request. Using CRA + TS for anything but the most basic project setup is not supported currently. For composite projects in particular, there really isn't much support in Webpack at all ATM (@ts-tools/webpack-loader, ts-loader, awesome-typescript-loader, etc.). It's a complicated feature and no one has done the work to properly integrate it yet. So unless you're using Some other loaders can handle more complicated setups. E.g. @ts-tools/webpack-loader can do monorepos, but it has it's own drawbacks that make it problematic (e.g. doesn't play nice w/ downstream loaders). It's all a bit of a clustf*ck at this point and I'm hoping the TS build landscape looks a bit better in the next year. |
I'm finding in my CRA project that uses Though yes, I agree that it's a pretty hairy system at the moment. |
@osdiab The monorepo issue occurs with nested linked imports: Say you have monorepo, with modules
ts-tools/webpack-loader handles this by parsing multiple config files as required. I'm still trying to find a way to make this work w/ CRA that isn't nasty. E.g. I've setup a sample monorepo that demonstrates the issue. The current roadblock is that babel-loader rule limits To get to this point I use typescript to parse the config file properly ( I've had to move on to other stuff for a bit, but I'll come back to this to figure out why this is the case and if I can work around it. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This is still an issue and should not be closed |
I am also looking for a solution to this issue. Current workaround: |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This is still an issue and should not be closed |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This is still an issue, and would really like if this could be solved 🙏 ! |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
Shouldn't be closed. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
The issue still persist, it would be really nice to have the feature! |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
Any chance to enjoy a better CRA typescript support in the near future? |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
ding dong |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This is still an issue
…On Sun, May 17, 2020 at 08:01 stale[bot] ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
any recent activity. It will be closed in 5 days if no further activity
occurs.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#7147 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACRAOL2DTUBL2M43R5BLSTRR735PANCNFSM4HSBG7FQ>
.
|
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
still a problem |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
still a problem
Omar
…On Sat, Jul 18, 2020 at 3:13 PM stale[bot] ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
any recent activity. It will be closed in 5 days if no further activity
occurs.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7147 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAONU3QRXC5D4UII4UBWKOTR4E4QLANCNFSM4HSBG7FQ>
.
|
What would it take to get someone assigned to this? |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
Still a problem.
Omar
…On Sun, Aug 23, 2020 at 8:06 AM stale[bot] ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
any recent activity. It will be closed in 5 days if no further activity
occurs.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7147 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAONU3W3LCJJJNUZB5FW5ELSCBFPXANCNFSM4HSBG7FQ>
.
|
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
Still a problem
Omar
…On Oct 4, 2020 at 15:28:51, stale[bot] ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
any recent activity. It will be closed in 5 days if no further activity
occurs.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7147 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAONU3QR7K3MSYLYGOUYJL3SJAI2HANCNFSM4HSBG7FQ>
.
|
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
Not stale
Omar
…On Dec 26, 2020 at 04:11:14, stale[bot] ***@***.***> wrote:
This issue has been automatically marked as stale because it has not had
any recent activity. It will be closed in 5 days if no further activity
occurs.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7147 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAONU3S5754XOMUS7OOKSF3SWTPVDANCNFSM4HSBG7FQ>
.
|
UPDATE: this might now be an answer since the issue author mentioned a "one command" rather than "tsc --build", but nonetheless for some it might be helpful this is what worked for me DISCLAIMER: So basically the idea is that you need to compile your composite project and have its output saved in your out-dir folder before you run
So you need to modify the before: "scripts": {
"start": "react-scripts start ",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}, after: "scripts": {
"start": "react-scripts start ",
"build": "node ./node_modules/typescript/bin/tsc --build ./tsconfig.json && react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}, so what it does it pre-builds your composite project and spits out the results to a local folder (which is then when below is the exact configuration // src/basics/tsconfig.json
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"composite": true,
"outDir": "../../bin/basics"
},
"include": [
"./**/*.ts",
"./**/*.tsx"
]
} // src/components/tsconfig.json
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"composite": true,
"outDir": "../../bin/components"
},
"include": [
"./**/*.ts",
"./**/*.tsx"
],
"references": [
{
"path": "../basics/tsconfig.json"
},
{
"path": "../data/tsconfig.json"
}
]
} // src/data/tsconfig.json
{
"extends": "../tsconfig-base.json",
"compilerOptions": {
"composite": true,
"outDir": "../../bin/data"
},
"include": [
"./**/*.ts",
"./**/*.tsx"
],
"references": [
{
"path": "../basics/tsconfig.json"
}
]
} // src/tsconfig-base.json
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"noImplicitAny": false,
"strictNullChecks": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx"
}
} // tsconfig.json
{
"extends": "./src/tsconfig-base.json",
"include": [
"./src/*.ts",
"./src/*.tsx"
],
"compilerOptions": {
"noEmit": true
},
"references": [
{
"path": "./src/basics/tsconfig.json"
},
{
"path": "./src/data/tsconfig.json"
},
{
"path": "./src/components/tsconfig.json"
}
]
} |
TypeScript 3.0 introduced project references / composite projects. This allows to split a TypeScript build into sub-projects, while automatically keeping track of dependencies. Currently `react-scripts` uses the legacy build TypeScript build mode without composite project support. Composite projects are supported for a long time by `fork-ts-checker-webpack-plugin` but wasn't enabled in the Webpack. This commit enables the `build` flag for TypeScript Webpack config, and fixes support for composite projects. Closes facebook#7147
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
typescript composite isolatedModules
Environment
Steps to Reproduce
yarn create react-app my-app --typescript
composite: true
totsconfig.json
yarn start
, getOption 'composite' cannot be specified with option 'isolatedModules'. TS5053
isolatedModules
line fromtsconfig
yarn start
,create-react-app
re-addsisolatedModules
and you get the same errorExpected Behavior
I could use the
composite
flagActual Behavior
I can't use the composite flag
Reproducible Demo
Above steps will reproduce this, pretty trivial.
This is potentially equally as much a
typescript
issue, though this is not really big to me—i just want to be able to build all my packages in my monorepo in one command, rather than having a separate invocation oftsc --build
for my website package. But thought I'd log the issue here.The text was updated successfully, but these errors were encountered: