Issue
I'm trying to get my typescript project to build. It has built successfully in the past with the same settings, but now it's not building even though it isn't showing any errors. I run:
npx tsc -p tsconfig.json
Where my tsconfig.json is:
{
"compilerOptions": {
"module": "ES6",
"target": "ES6",
"declaration": true,
"outDir": "./lib",
"strict": true,
"jsx": "react-native",
"skipLibCheck": true,
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
},
"include": [
"src/**/*"
],
"extends": "expo/tsconfig.base"
}
No lib folder is produced at all.
My src folder contains several typescript files, as well as an index that exports the required components.
I'm really confused because my project structure and settings haven't changed at all yet tsc is no longer producing the outDir or any of the files when it worked before.
Solution
Expo is using typescript for typechecking only. Bundling files is done with Metro bundler. Thus expo/tsconfig.base has noEmit option set to true.
If you want to compile js files yourself you have to either run you command as:
npx tsc -p tsconfig.json --noEmit false
or to set noEmit option to false in your tsconfig.json. Don't forget to remove it back in you tsconfig. Or next time on build expo will run both metro bundling and tsc typecheck and tsc compilation.
As as the last resort you may stop extending expo/tsconfig.base in your tsconfig.json. But do this only if you really know what you're doing.
Answered By - aleksxor
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.