Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
A project to create a pedestal of universe
React/Vue/Angular base technology I chose React
npx create-react-app micro-app
Copy the code
All webPack configurations appear
npm run eject
Copy the code
The installationless less-loader
CSS I choose less, can install SASS can
npm i --save-dev less less-loader
Copy the code
*** Pay attention to the configuration of less and less-Loader versions
In webpack.config.js, configure less as sASS
// less const lessRegex=/\. Less $/; const lessModuleRegex= /\.module\.less$/; // Less {test: lessRegex, exclude: lessModuleRegex, use: getStyleLoaders({importLoaders: 3, sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, }, 'less-loader' ), // Don't consider CSS imports dead code even if the // containing package claims to have no side effects. // Remove this when webpack adds a warning or an error for this. // See https://github.com/webpack/webpack/issues/6571 sideEffects: true, }, // Adds support for CSS Modules, but using SASS // using the extension .module.scss or .module.sass { test: lessModuleRegex, use: getStyleLoaders( { importLoaders: 3, sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment, modules: { getLocalIdent: getCSSModuleLocalIdent, }, }, 'less-loader' ), },Copy the code
Install routing, Universe, ANTD
npm i react-router-dom
npm i qiankun -S
npm i antd
Copy the code
Close the eslint
Create -react-app uses the process.env.disable_eslint_plugin =true field to enable and disable ESLint
Add process.env.disable_eslint_plugin =true to the appropriate start.js file
Configure some simple parameters for the base
RegisterMicroApps, start, runAfterFirstMounted, and setDefaultMountApp are all required
SetDefaultMountApp: setDefaultMountApp: Set the default microapp to be loaded after the main app. RunAfterFirstMounted: The method that needs to be called after the first microapplication is loaded, generally used for burying points, etcCopy the code
How to update the qiankun base configuration and sub-application configuration, how to deploy independently