Skip to content
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

[Tooling]: tsc watch #16851

Closed
pranshuchittora opened this issue Aug 1, 2019 · 3 comments
Closed

[Tooling]: tsc watch #16851

pranshuchittora opened this issue Aug 1, 2019 · 3 comments

Comments

@pranshuchittora
Copy link
Contributor

As a developer, I use to make a lot of mistakes. As on now for every change, we need to build the package, this becomes quite frustrating.
Pls correct me if I am wrong.

Expected Behavior 🤔

Instantly build the changes, using tsc watch mode.

Current Behavior 😯

Huge development cycle.

Try this

diff --git a/packages/material-ui/package.json b/packages/material-ui/package.json
index 69c76bf..4064d98 100644
--- a/packages/material-ui/package.json
+++ b/packages/material-ui/package.json
@@ -30,7 +30,8 @@
     "prebuild": "rimraf build",
     "release": "yarn build && npm publish build --tag latest",
     "test": "cd ../../ && cross-env NODE_ENV=test mocha 'packages/material-ui/**/*.test.js' --exclude '**/node_modules/**'",
-    "typescript": "tslint -p tsconfig.json \"{src,test}/**/*.{ts,tsx}\" && tsc -p tsconfig.test.json"
+    "typescript": "tslint -p tsconfig.json \"{src,test}/**/*.{ts,tsx}\" && tsc -p tsconfig.test.json",
+    "watch": "npm run build && tsc -w"
   },
   "peerDependencies": {
     "react": "^16.8.0",

https://www.typescriptlang.org/docs/handbook/configuring-watch.html

@pranshuchittora
Copy link
Contributor Author

Every time I run build the build directory gets deleted, hence the linking breaks.

Failed to compile.

../material-ui/packages/material-ui/build/esm/SvgIcon/index.js
Error: ENOENT: no such file or directory, open '/home/wasd/github/material-ui/packages/material-ui/build/esm/SvgIcon/index.js'


@merceyz
Copy link
Member

merceyz commented Aug 9, 2019

We don't use tsc to build anything so what you'd want is to add --watch to any of the build scripts
https://babeljs.io/docs/en/babel-cli#compile-files

If you just want typechecking then you can use
tsc -p tsconfig.test.json -w

@eps1lon
Copy link
Member

eps1lon commented Aug 28, 2019

yarn workspace @material-ui/core typescript -w would incidentally already work. This script doesn't do what you think it does though. If you want to build the esm build in watchmode you can run yarn workspace @material-ui/core build:esm --watch.

For build --watch see #15497

@eps1lon eps1lon closed this as completed Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants