-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Typescript examples are broken #4528
Labels
good first issue
Easy to fix issues, good for newcomers
Comments
timneutkens
pushed a commit
that referenced
this issue
Jun 6, 2018
Hello! I ran into an issue using typescript and jest with next 6.0.0. I was able to work through fixing it and I wanted to share my solution back to next.js, by upgrading the with-jest-typescript example to next 6.0.0. The steps I followed were: 1. `npx babel-upgrade --write` which added babel-core@^7.0.0-bridge.0 to allow jest's babel 6 to play nice with next's babel 7 2. Remove `ts-jest` and replace with `babel-jest` to use babel to transform the typescript code, as is done when the dev and production builds run 3. Update the babelrc to use commonjs modules in test mode to be compatible with jest Also, I removed the `NODE_ENV=test` on the jest task, because jest sets the env to test anyways, and I'm on windows where this code is incorrect. The other option is to use `cross-env` but I felt it was simpler to just remove the environment override. To my knowledge, this PR would help on the following issues: #3663 #4227 #4531 #4528 #4239
lependu
pushed a commit
to lependu/next.js
that referenced
this issue
Jun 19, 2018
Hello! I ran into an issue using typescript and jest with next 6.0.0. I was able to work through fixing it and I wanted to share my solution back to next.js, by upgrading the with-jest-typescript example to next 6.0.0. The steps I followed were: 1. `npx babel-upgrade --write` which added babel-core@^7.0.0-bridge.0 to allow jest's babel 6 to play nice with next's babel 7 2. Remove `ts-jest` and replace with `babel-jest` to use babel to transform the typescript code, as is done when the dev and production builds run 3. Update the babelrc to use commonjs modules in test mode to be compatible with jest Also, I removed the `NODE_ENV=test` on the jest task, because jest sets the env to test anyways, and I'm on windows where this code is incorrect. The other option is to use `cross-env` but I felt it was simpler to just remove the environment override. To my knowledge, this PR would help on the following issues: vercel#3663 vercel#4227 vercel#4531 vercel#4528 vercel#4239
@timneutkens This issue was fixed by de6bf4e... HOWEVERI did just learn that I needed to update |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
Describe the bug
I tried to launch
with-jest-typescript
example, but seems like it's broken.To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
yarn create next-app --example with-jest-typescript with-jest-typescript-app
http://localhost:3000/
and try to updated the pageYou will able to see error:
TypeError: Cannot read property 'extensions' of null
Also
yarn test
is broken too. It fails with errorExpected behavior
All works fine
Screenshots
System information
Updated:
Same for
with-typescript-app
yarn create next-app --example with-typescript with-typescript-app
http://localhost:3000/
and try to updated the pageYou will able to see another error:
The text was updated successfully, but these errors were encountered: