摘要: 1.压缩JS代码,mode设置为production后,打包时自动压缩代码 mode:'production', 2.压缩html文件,html文件不需要处理兼容问题,压缩文件只需要在plugins中的HtmlWebpackPlugin中配置minify即可 new HtmlWebpackPlugi 阅读全文
posted @ 2020-06-05 23:48 HLLZ 阅读(1596) 评论(0) 推荐(0) 编辑
摘要: 因为es6语法不兼容部分浏览器,所以要对项目进行配置 1.安装依赖 npm install babel-loader @babel/preset-env @babel/core core-js -D //第一三方法安装这个npm install @babel/polyfill -D //第二个方法安 阅读全文
posted @ 2020-06-05 23:15 HLLZ 阅读(900) 评论(0) 推荐(0) 编辑
摘要: 1.安装依赖包 npm install eslint-config-airbnb-base eslint-plugin-import eslint eslint-loader -D 2.在loader中进行配置 /* eslint语法检查:eslint-loader selint注意:只检查自己的j 阅读全文
posted @ 2020-06-05 20:53 HLLZ 阅读(2055) 评论(1) 推荐(0) 编辑
摘要: 提取css成单独文件 1.安装插件并引入 npm install mini-css-extract-plugin -D const MiniCssExtractPlugin = require('mini-css-extract-plugin') 2.配置插件plugins plugins: [ n 阅读全文
posted @ 2020-06-05 16:36 HLLZ 阅读(755) 评论(0) 推荐(0) 编辑
摘要: /** * 生成package.json: npm init * 需要安装的包:npm install webpack webpack-cli style-loader css-loader less-loader sass-loader url-loader file-loader html-lo 阅读全文
posted @ 2020-06-05 09:42 HLLZ 阅读(1677) 评论(0) 推荐(1) 编辑
摘要: (个人复习时使用) 1.配置提供器 import React from 'react'; import ReactDOM from 'react-dom'; import TodoList from './TodoList' import { Provider} from 'react-redux' 阅读全文
posted @ 2020-06-04 16:21 HLLZ 阅读(587) 评论(0) 推荐(0) 编辑
摘要: 1.配置store下的index.js文件 import { createStore , applyMiddleware ,compose } from 'redux' // 引入createStore方法 import reducer from './reducer' import saga fr 阅读全文
posted @ 2020-06-04 13:53 HLLZ 阅读(422) 评论(0) 推荐(0) 编辑
摘要: redux-thunk 就是让store.dispatch()中可以传函数了,以前传的都是对象(百度到的介绍,供个人复习便于理解) 官方文档 const store = createStore( reducer, applyMiddleware(thunk) ) 因为createStore中只能放两 阅读全文
posted @ 2020-06-04 10:26 HLLZ 阅读(367) 评论(0) 推荐(0) 编辑
摘要: 1.安装 egg-cors npm i egg-cors --save/cnpm i egg-cors --save 2.配置plugin.js exports.cors = { enable: true, package: 'egg-cors', }; 3.配置config.default.js 阅读全文
posted @ 2020-06-03 17:39 HLLZ 阅读(1653) 评论(0) 推荐(0) 编辑
摘要: 方法一 1.安装http-proxy-middleware,下面两种都可。 yarn add http-proxy-middleware //npm install http-proxy-middleware -D 2.在'src'目录下新建'setupProxy.js'文件并写入以下代码(注意第二 阅读全文
posted @ 2020-06-03 17:29 HLLZ 阅读(1543) 评论(0) 推荐(0) 编辑