From ec836f38e30cd6470145ea20494b6a26693c9fb3 Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Thu, 27 Oct 2022 09:51:11 +0200 Subject: [PATCH 1/3] [Demo] Move e-commerce demo from webpack to vite --- examples/demo/README.md | 4 +- examples/demo/build.js | 21 - examples/demo/{public => }/index.html | 14 +- examples/demo/package.json | 21 +- examples/demo/src/index.tsx | 5 - examples/demo/tsconfig.json | 3 +- examples/demo/tsconfig.node.json | 10 + examples/demo/vite.config.ts | 49 ++ package.json | 4 +- yarn.lock | 855 +++++++++++++++++++++++++- 10 files changed, 897 insertions(+), 89 deletions(-) delete mode 100644 examples/demo/build.js rename examples/demo/{public => }/index.html (86%) create mode 100644 examples/demo/tsconfig.node.json create mode 100644 examples/demo/vite.config.ts diff --git a/examples/demo/README.md b/examples/demo/README.md index 31bea588a2e..b48d4c66f73 100644 --- a/examples/demo/README.md +++ b/examples/demo/README.md @@ -26,7 +26,7 @@ make run-demo In the project directory, you can run: -### `npm start` +### `npm dev` Runs the app in the development mode.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. @@ -39,7 +39,7 @@ You will also see any lint errors in the console. Launches the test runner in the interactive watch mode.
See the section about [running tests](#running-tests) for more information. -### `npm run build` +### `npm build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. diff --git a/examples/demo/build.js b/examples/demo/build.js deleted file mode 100644 index a88b4a4b51e..00000000000 --- a/examples/demo/build.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Rewrite Webpack config without ejecting CRA thanks to rewire - * @link https://stackoverflow.com/questions/55165466/how-to-build-a-production-version-of-react-without-minification - */ -const rewire = require('rewire'); -const defaults = rewire('react-scripts/scripts/build.js'); -const config = defaults.__get__('config'); - -/** - * Do not mangle component names in production, for better learning experience - * @link https://kentcdodds.com/blog/profile-a-react-app-for-performance#disable-function-name-mangling - */ -config.optimization.minimizer[0].options.minimizer.options.keep_classnames = true; -config.optimization.minimizer[0].options.minimizer.options.keep_fnames = true; - -/** - * Do not disable component profiling in production, for better learning experience - * @link https://kentcdodds.com/blog/profile-a-react-app-for-performance#update-the-webpack-config-for-production-profiling - */ -config.resolve.alias['react-dom$'] = 'react-dom/profiling'; -config.resolve.alias['scheduler/tracing'] = 'scheduler/tracing-profiling'; diff --git a/examples/demo/public/index.html b/examples/demo/index.html similarity index 86% rename from examples/demo/public/index.html rename to examples/demo/index.html index 1ba87a95de8..3812163d880 100644 --- a/examples/demo/public/index.html +++ b/examples/demo/index.html @@ -7,17 +7,8 @@ content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no" /> - - - + + Posters Galore Administration