codesandbox / codesandbox/codesandbox-client
Can't get React+Typescript to deploy to GitHub Pages
Open
@tristandubbeld is already working on this.
Since Jan 4, 2023.
- Dominant language
- JavaScript
- Stars
- 13.6k
- Forks
- 2.4k
- Avg merge
- 6d 19h
- Merged PRs (30d)
- 2
Description
🐛 bug report
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project
adheres to. - I have searched the issue tracker for an issue that matches the one I want
to file, without success.
Description of the problem
Can't get even the official React+Typescript template to deploy to GitHub Pages
Is this because its not compiling the TS before deploying?
Codesandbox err:
Cannot create production bundle. yarn run v1.22.5 $ react-scripts build Creating an optimized production build... Failed to compile. /tmp/deploys/k2x852/clbx12ehf1kro0us8b2yseh4e/source/src/index.tsx TypeScript error in /tmp/deploys/k2x852/clbx12ehf1kro0us8b2yseh4e/source/src/index.tsx(7,25):
Argument of type 'HTMLElement | null' is not assignable to parameter of type 'Element | DocumentFragment'. Type 'null' is not assignable to type 'Element | DocumentFragment'.
TS2345 5 | 6 | const rootElement = document.getElementById("root"); > 7 | const root = createRoot(rootElement); | ^ 8 | 9 | root.render( 10 | <StrictMode> info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. | warning package.json: No license field The following changes are being made to your tsconfig.json file: - compilerOptions.target to be suggested value: es5 (this can be changed) - compilerOptions.allowJs to be suggested value: true (this can be changed) - compilerOptions.skipLibCheck to be suggested value: true (this can be changed) - compilerOptions.allowSyntheticDefaultImports to be suggested value: true (this can be changed) - compilerOptions.forceConsistentCasingInFileNames to be suggested value: true (this can be changed) - compilerOptions.noFallthroughCasesInSwitch to be suggested value: true (this can be changed) - compilerOptions.module must be esnext (for import() and import/export) - compilerOptions.moduleResolution must be node (to match webpack resolution) - compilerOptions.resolveJsonModule must be true (to match webpack loader) - compilerOptions.isolatedModules must be true (implementation limitation) - compilerOptions.noEmit must be true error Command failed with exit code 1.
How has this issue affected you? What are you trying to accomplish?
Looking to setup a React+Typscript project in Codesandbox that is deployed to Github Pages.
To Reproduce
- go to sandbox https://codesandbox.io/s/busy-diffie-k2x852
- click to deploy to github pages
Link to sandbox:
https://codesandbox.io/s/busy-diffie-k2x852
Your Environment
| Software | Name/Version |
|---|---|
| Сodesandbox | 3bf994970 |
| Browser | Chrome Version 108.0.5359.124 (Official Build) (x86_64) |
| Operating System | macOS 12.6.1 (21G217) |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.