From 1970a783e1ee4fdad4495c8dc5c64648e0e42b02 Mon Sep 17 00:00:00 2001 From: cahnory Date: Thu, 27 Jan 2022 13:23:05 +0100 Subject: [PATCH] WIP --- apps/web-client/package.json | 1 + apps/web-client/src/App.js | 21 +- libs/babel-config/index.js | 2 +- libs/config-eslint/package.json | 2 +- libs/eslint-config/package.json | 2 +- .../components/RenderProvider.js | 36 +- libs/webpack-config/entries/browser.js | 6 +- libs/webpack-config/entries/node.js | 73 +- libs/webpack-config/index.js | 96 +- libs/webpack-config/package.json | 7 +- yarn.lock | 3801 +++++++---------- 11 files changed, 1772 insertions(+), 2275 deletions(-) diff --git a/apps/web-client/package.json b/apps/web-client/package.json index e528298..1ba2599 100644 --- a/apps/web-client/package.json +++ b/apps/web-client/package.json @@ -26,6 +26,7 @@ "@witb/jest-config": "0.1.0", "@witb/prettier-config": "0.1.0", "eslint": "^8.2.0", + "imagemin": "^8.0.1", "jest": "^27.3.1", "prettier": "^2.4.1", "webpack-cli": "^4.9.1" diff --git a/apps/web-client/src/App.js b/apps/web-client/src/App.js index 3a714de..0e711a2 100644 --- a/apps/web-client/src/App.js +++ b/apps/web-client/src/App.js @@ -1,17 +1,18 @@ -import React from "react"; +import React, { lazy } from "react"; import { ResponsePropType } from "@witb/webpack-config/utils"; -import loadable from "@loadable/component"; import { Routes, Route } from "react-router-dom"; -const Error404Page = loadable(() => import("./pages/Error404Page")); -const HomePage = loadable(() => import("./pages/HomePage")); +const Error404Page = lazy(() => import("./pages/Error404Page")); +const HomePage = lazy(() => import("./pages/HomePage")); -const App = ({ response }) => ( - - } /> - } /> - -); +function App({ response }) { + return ( + + } /> + } /> + + ); +} App.defaultProps = { response: null, diff --git a/libs/babel-config/index.js b/libs/babel-config/index.js index 6a5595d..cc3dd59 100644 --- a/libs/babel-config/index.js +++ b/libs/babel-config/index.js @@ -1,4 +1,4 @@ module.exports = () => ({ presets: ["@babel/preset-env", "@babel/preset-react", "@linaria"], - plugins: ["@babel/plugin-transform-runtime", "@loadable/babel-plugin"], + plugins: ["@babel/plugin-transform-runtime"], }); diff --git a/libs/config-eslint/package.json b/libs/config-eslint/package.json index 8d46fe2..150aa1f 100644 --- a/libs/config-eslint/package.json +++ b/libs/config-eslint/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "@witb/prettier-config": "0.1.0", - "eslint-config-airbnb": "^18.2.1", + "eslint-config-airbnb": "^19.0.4", "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.25.2", "eslint-plugin-jsx-a11y": "^6.4.1", diff --git a/libs/eslint-config/package.json b/libs/eslint-config/package.json index 051059c..540388a 100644 --- a/libs/eslint-config/package.json +++ b/libs/eslint-config/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "@witb/prettier-config": "0.1.0", - "eslint-config-airbnb": "^18.2.1", + "eslint-config-airbnb": "^19.0.4", "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.25.2", "eslint-plugin-jsx-a11y": "^6.4.1", diff --git a/libs/webpack-config/components/RenderProvider.js b/libs/webpack-config/components/RenderProvider.js index 75b1dcf..46f532f 100644 --- a/libs/webpack-config/components/RenderProvider.js +++ b/libs/webpack-config/components/RenderProvider.js @@ -1,17 +1,11 @@ -import React, { createContext } from "react"; +import React, { createContext, useMemo } from "react"; import PropTypes from "prop-types"; export const Context = createContext(); -const filterHmrElements = (elements) => - elements.filter( - (element) => - !(element.props.src || element.props.href)?.match(/-wps-hmr\.[^.\\/]+$/), - ); - -const Provider = ({ children, html, extractor, collector }) => ( - ({ scripts: [