mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
added react fast reload
This commit is contained in:
parent
25dade6c67
commit
6a6985c39b
4 changed files with 45 additions and 37 deletions
|
@ -1,4 +1,5 @@
|
||||||
const CracoAlias = require('craco-alias');
|
const CracoAlias = require('craco-alias');
|
||||||
|
const fastRefreshCracoPlugin = require('craco-fast-refresh');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
webpack: {
|
webpack: {
|
||||||
|
@ -14,27 +15,28 @@ module.exports = {
|
||||||
mode: 'file',
|
mode: 'file',
|
||||||
},
|
},
|
||||||
jest: {
|
jest: {
|
||||||
setupTestFrameworkScriptFile: "<rootDir>/src/setupTests.js",
|
setupTestFrameworkScriptFile: '<rootDir>/src/setupTests.js',
|
||||||
configure: {
|
configure: {
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
"^~/(.*)$": "<rootDir>/src/$1",
|
'^~/(.*)$': '<rootDir>/src/$1',
|
||||||
"^.+\\.scss$": "identity-obj-proxy"
|
'^.+\\.scss$': 'identity-obj-proxy',
|
||||||
},
|
},
|
||||||
snapshotSerializers: ["enzyme-to-json/serializer"],
|
snapshotSerializers: ['enzyme-to-json/serializer'],
|
||||||
moduleFileExtensions: ["js", "json", "ts", "tsx", "jsx", "node"],
|
moduleFileExtensions: ['js', 'json', 'ts', 'tsx', 'jsx', 'node'],
|
||||||
verbose: true,
|
verbose: true,
|
||||||
roots: ["<rootDir>/src"],
|
roots: ['<rootDir>/src'],
|
||||||
transform: {
|
transform: {
|
||||||
"^.+\\.tsx?$": "ts-jest",
|
'^.+\\.tsx?$': 'ts-jest',
|
||||||
"^.+\\.ts?$": "babel-jest",
|
'^.+\\.ts?$': 'babel-jest',
|
||||||
"^.+\\.js?$": "ts-jest",
|
'^.+\\.js?$': 'ts-jest',
|
||||||
"^.+\\.jsx?$": "babel-jest"
|
'^.+\\.jsx?$': 'babel-jest',
|
||||||
|
},
|
||||||
|
preset: 'ts-jest/presets/js-with-ts',
|
||||||
|
testEnvironment: 'node',
|
||||||
},
|
},
|
||||||
preset: "ts-jest/presets/js-with-ts",
|
|
||||||
testEnvironment: "node"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
{ plugin: fastRefreshCracoPlugin },
|
||||||
{
|
{
|
||||||
plugin: CracoAlias,
|
plugin: CracoAlias,
|
||||||
options: {
|
options: {
|
||||||
|
|
|
@ -44,8 +44,7 @@
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
"react-app",
|
"react-app"
|
||||||
"react-app/jest"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
|
@ -61,12 +60,13 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@craco/craco": "5.8.0",
|
||||||
"@types/classnames": "^2.2.7",
|
"@types/classnames": "^2.2.7",
|
||||||
"@types/node": "^11.13.22",
|
"@types/node": "^11.13.22",
|
||||||
"@types/ramda": "^0.26.33",
|
"@types/ramda": "^0.26.33",
|
||||||
"@types/react-redux": "^7.1.11",
|
"@types/react-redux": "^7.1.11",
|
||||||
"@craco/craco": "5.8.0",
|
|
||||||
"craco-alias": "^2.1.1",
|
"craco-alias": "^2.1.1",
|
||||||
|
"craco-fast-refresh": "^1.0.2",
|
||||||
"prettier": "^1.18.2"
|
"prettier": "^1.18.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { FC, ChangeEvent, useCallback, useState, useEffect, LegacyRef } from 'react';
|
import React, {ChangeEvent, FC, useCallback, useEffect, useState} from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import styles from '~/styles/common/inputs.module.scss';
|
import styles from '~/styles/common/inputs.module.scss';
|
||||||
import {Icon} from '~/components/input/Icon';
|
import {Icon} from '~/components/input/Icon';
|
||||||
|
|
|
@ -78,7 +78,13 @@ const EditorDialogUnconnected: FC<IProps> = ({
|
||||||
<EditorPanel data={data} setData={setData} temp={temp} setTemp={setTemp} />
|
<EditorPanel data={data} setData={setData} temp={temp} setTemp={setTemp} />
|
||||||
|
|
||||||
<Group horizontal>
|
<Group horizontal>
|
||||||
<InputText title="Название" value={data.title} handler={setTitle} autoFocus />
|
<InputText
|
||||||
|
title="Название"
|
||||||
|
value={data.title}
|
||||||
|
handler={setTitle}
|
||||||
|
autoFocus
|
||||||
|
maxLength={256}
|
||||||
|
/>
|
||||||
|
|
||||||
<Button title="Сохранить" iconRight="check" />
|
<Button title="Сохранить" iconRight="check" />
|
||||||
</Group>
|
</Group>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue