Fix dev command for TS support

Gosh, I'm really down this rabbit hole, huh? :p Anyway, turns out the `vercel dev` command contains a _fork_ of ts-node that doesn't respect the `ts-node` override key in `tsconfig.json`. But it does respect the env var!

So I've now set up `yarn start` to invoke `vercel dev` with the new env, which in turn invokes `yarn dev` to start the create-react-app dev server. Whew! (Probably a better dev experience tbh.)
This commit is contained in:
Emi Matchu 2021-02-02 22:25:54 -08:00
parent 4483df2040
commit 1dda0d4edb
3 changed files with 1250 additions and 14 deletions

View file

@ -50,7 +50,8 @@
"xmlrpc": "^1.3.2" "xmlrpc": "^1.3.2"
}, },
"scripts": { "scripts": {
"start": "yarn build-cached-data && REACT_APP_IMPRESS_LOG_IN_AS=$IMPRESS_LOG_IN_AS react-scripts start", "start": "TS_NODE_COMPILER_OPTIONS='{\"target\": \"esnext\", \"module\": \"commonjs\"}' vercel dev",
"dev": "yarn build-cached-data && REACT_APP_IMPRESS_LOG_IN_AS=$IMPRESS_LOG_IN_AS react-scripts start",
"build": "yarn build-cached-data && react-scripts build", "build": "yarn build-cached-data && react-scripts build",
"vercel-build": "yum install libuuid-devel libmount-devel && cp /lib64/{libuuid,libmount,libblkid}.so.1 node_modules/canvas/build/Release/", "vercel-build": "yum install libuuid-devel libmount-devel && cp /lib64/{libuuid,libmount,libblkid}.so.1 node_modules/canvas/build/Release/",
"test": "react-scripts test --env=jsdom", "test": "react-scripts test --env=jsdom",
@ -82,6 +83,7 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"5to6-codemod": "^1.8.0",
"apollo-server-testing": "^2.12.0", "apollo-server-testing": "^2.12.0",
"auth0": "^2.28.0", "auth0": "^2.28.0",
"dotenv-cli": "^3.1.0", "dotenv-cli": "^3.1.0",
@ -90,6 +92,7 @@
"jest-image-snapshot": "^4.3.0", "jest-image-snapshot": "^4.3.0",
"prettier": "^2.0.5", "prettier": "^2.0.5",
"react-is": "^16.13.1", "react-is": "^16.13.1",
"ts-node": "^9.1.1" "ts-node": "^9.1.1",
"vercel": "^21.2.2"
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "esnext",
"module": "esnext", "module": "esnext",
"downlevelIteration": true, "downlevelIteration": true,
"strict": true, "strict": true,
@ -23,6 +23,7 @@
}, },
"ts-node": { "ts-node": {
"compilerOptions": { "compilerOptions": {
"target": "esnext",
"module": "commonjs" "module": "commonjs"
} }
}, },

1254
yarn.lock

File diff suppressed because it is too large Load diff