perf: reduce drastically build size

BREAKING CHANGE: This package is now pure ESM
This commit is contained in:
Divlo
2022-04-06 23:52:50 +02:00
parent ec4929d7d8
commit 686b5643b3
24 changed files with 9454 additions and 13731 deletions

View File

@ -1,3 +0,0 @@
node_modules
.cache
dist

View File

@ -1 +1 @@
declare module "*.jpg"
declare module '*.jpg'

View File

@ -3,7 +3,6 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="shortcut icon" href="./github.jpg" type="image/jpg" />
<title>react-component-form</title>
</head>

View File

@ -1,11 +1,13 @@
import * as React from 'react'
import * as ReactDOM from 'react-dom'
import { Form, HandleForm } from '../.'
import React from 'react'
import { createRoot } from 'react-dom/client'
import { Form, HandleForm } from 'react-component-form'
import './index.css'
import GitHubLogo from 'url:./github.jpg'
const App = () => {
global.React = React
const App: React.FC = () => {
const handleSubmit: HandleForm = (formData, formElement) => {
console.clear()
console.log('onSubmit: ', formData)
@ -60,4 +62,6 @@ const App = () => {
)
}
ReactDOM.render(<App />, document.getElementById('root'))
const container = document.getElementById('root') as HTMLElement
const root = createRoot(container)
root.render(<App />)

3325
example/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,21 @@
{
"name": "example",
"version": "1.0.0",
"license": "MIT",
"type": "module",
"private": true,
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html --public-url \"/react-component-form/\""
},
"dependencies": {
"react": "file:../node_modules/react",
"react-dom": "file:../node_modules/react-dom"
"react-dom": "file:../node_modules/react-dom",
"react-component-form": "file:.."
},
"devDependencies": {
"@parcel/transformer-image": "2.3.2",
"@types/react": "17.0.39",
"@types/react-dom": "17.0.11",
"parcel": "2.3.2",
"typescript": "4.5.5"
"@parcel/transformer-image": "2.4.1",
"@types/react": "17.0.43",
"@types/react-dom": "17.0.14",
"parcel": "2.4.1",
"typescript": "4.6.3"
}
}

View File

@ -1,18 +1,12 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": false,
"target": "es5",
"module": "commonjs",
"module": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"target": "ESNext",
"jsx": "react",
"moduleResolution": "node",
"noImplicitAny": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"removeComments": true,
"strictNullChecks": true,
"preserveConstEnums": true,
"sourceMap": true,
"lib": ["es2015", "es2016", "dom"],
"types": ["node"]
"strict": true,
"esModuleInterop": true
}
}