fix: build issue with "React is not defined"

This commit is contained in:
Divlo 2022-04-07 11:37:42 +02:00
parent 686b5643b3
commit 8cbe5c3bf2
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9
6 changed files with 3 additions and 8 deletions

View File

@ -5,8 +5,6 @@ import { Form, HandleForm } from 'react-component-form'
import './index.css' import './index.css'
import GitHubLogo from 'url:./github.jpg' import GitHubLogo from 'url:./github.jpg'
global.React = React
const App: React.FC = () => { const App: React.FC = () => {
const handleSubmit: HandleForm = (formData, formElement) => { const handleSubmit: HandleForm = (formData, formElement) => {
console.clear() console.clear()

View File

@ -1,7 +1,6 @@
{ {
"testEnvironment": "jsdom", "testEnvironment": "jsdom",
"rootDir": "./src", "rootDir": "./src",
"setupFilesAfterEnv": ["<rootDir>/__test__/setup.ts"],
"transform": { "transform": {
"^.+\\.tsx?$": "esbuild-jest" "^.+\\.tsx?$": "esbuild-jest"
} }

View File

@ -1,3 +1,4 @@
import React from 'react'
import { render, cleanup, fireEvent } from '@testing-library/react' import { render, cleanup, fireEvent } from '@testing-library/react'
import { Form, HandleForm } from '..' import { Form, HandleForm } from '..'

View File

@ -1,3 +0,0 @@
import React from 'react'
global.React = React

View File

@ -1,4 +1,4 @@
import { useRef } from 'react' import React, { useRef } from 'react'
export interface FormDataObject { export interface FormDataObject {
[key: string]: FormDataEntryValue [key: string]: FormDataEntryValue

View File

@ -13,7 +13,7 @@
"noUnusedLocals": true, "noUnusedLocals": true,
"noUnusedParameters": true, "noUnusedParameters": true,
"moduleResolution": "node", "moduleResolution": "node",
"jsx": "react-jsx", "jsx": "react",
"esModuleInterop": true, "esModuleInterop": true,
"skipLibCheck": true, "skipLibCheck": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,