Giter Club home page Giter Club logo

all-demo's Introduction

外壳

  • lerna 管理包
  • eslint 规范代码
  • husky 监听提交代码

main

  • npm install webpack webpack-cli
  • 创建 webpack.config.js
修改指向文件到build/webpack.config.js中
修改指向文件到build/webpack.config.js中
  • 安装 html-webpack-plugin,搭建 html 模板
在webpack.config.js中配置这个plugin,先引入,再配置再plugins中,配置项可以查文档
  • 安装 babel 的几个核心包以及修改 package.json 的 browerlist
cnpm i babel-loader @babel/core @babel/preset-env -D
在webpack.config.js中添加rules,让babel对打包的文件转义
  • 安装 react 以及@babel/preset-react
cnpm i @babel/preset-react -D
cnpm i react react-dom -S
  • 添加 clean-webpack-plugin 清除多次打包生成的文件
cnpm i clean-webpack-plugin -D
安装后在webpack.config.js中使用这个插件
  • 在 index.js 中添加入口

  • 添加 webpack-dev-server 开发模式

yarn add webpack-dev-server -D
dev": "webpack-dev-server --open
将devserver写道webpack.config.js中
  • 添加 react-router
yarn add react-router-dom --save
  • 配置 webpack 的 resolve
   resolve: {
        extensions: [".jsx", ".js"]
    },
  • 配置 alias
resolve:{
    alias:{
        '@':resolve('../src')
    }
}
  • 添加 qiankun
yarn add qiankun
mkdir micro-app.js文件
  • 安装 ant design,且按需加载
npm install antd --save
npm install babel-plugin-import -D
  • 安装 less,less-loader,css-loader,style-loader
npm install less-loader less style-loader css-loader
  • 安装 react-redux 作为存储
npm install react-redux -S
  • 安装 lerna 作为依赖管理
npm install --global lerna
  • 安装 eslint,使用爱彼迎的
npm install -g eslint
npm install -g eslint-config-airbnb eslint-plugin-import eslint-plugin-react eslint-plugin-jsx-a11y babel-eslint

Vue

  • 安全 vue 脚手架到全局
 npm install webpack webpack-cli -g
  • 安装一个 vue 的初始项目

  • 问题

    Error: Cannot find module 'webpack-cli/bin/config-yargs'

使用 webpack serve 来启动 webpack-dev-server
"start": "webpack serve  --config ./config/webpack.common.js "

const can only be used in a .ts file react native

在class组件中不能使用const,需要移到外面
  • 引入 antd 的样式错误
额外配置下css文件的解析,专门针对node_modules的
  • [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future
npm i --save-dev html-webpack-plugin@next
  • You need to export lifecycle functions in vue entry
在各个子项目中导出qiankun的生命周期
  • 'React' is defined but never used
eslint 规则添加‘"react/jsx-uses-react": 2’

all-demo's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.