https://github.com/leinov/webpack-react-multi-page
// clone git clone [email protected]:leinov/webpack-react-multi-page.git // 安装依赖包 npm install // 开发 npm run dev // 编译打包 npm run build // 启动生产页面 npm start
新创建页面在 src 下添加文件夹并创建pageinfo.json
然后npm run dev
即可
|-- src |-- index/ |-- page2/ |-- index.js |-- pageinfo.json
react16
webpack4
html-webpack-plugin 生成 html 文件
mini-css-extract-plugin css 分离打包
uglifyjs-webpack-plugin js 压缩
optimize-css-assets-webpack-plugin css 压缩
es6
babel
node
opn 打开浏览器
compression 开启 gzip 压缩
express
fs
git
|-- webpack-react-multi-pages //项目 |-- dist //编译生产目录 |-- index |-- index.css |-- index.js |-- about |-- about.css |-- about.js |-- images |-- index.html |-- about.html |-- node_modules //node 包 |-- src //开发目录 |-- index //index 页面打包入口 |-- images/ |-- js |-- app.js// 业务 js |-- index.sass |-- index.js //页面 js 入口 |-- about //about 页面打包入口 |-- images/ |--js |-- app.js// 业务 js |-- about.sass |-- about.js //页面 js 入口 |-- template.html // html 模板 |-- style.sass //公共 sass |-- webpackConfig //在 webpack 中使用 |-- getEntry.js //获取入口 |-- getFilepath.js //src 下需要打包页面文件夹 |-- htmlconfig.js //每个页面 html 注入数据 |-- package.json |-- .gitignore |-- webpack.config.js //webpack 配置文件 |-- www.js //生产启动程序
![]() | 1 fullpowers 2018-11-09 10:50:16 +08:00 前端戏真多,戏子也多 |
![]() | 2 leinov OP @fullpowers 少侠何出此言 |
![]() | 3 zongren 2018-11-09 10:53:58 +08:00 为啥要多个界面同时加载,不卡吗。。。 |
![]() | 4 leinov OP @zongren 开发时是热加载 速度很快的 http://www.leinov.com/webpack-react-multi-page/ 你可以克隆下来试下 |
5 buhi 2018-11-09 11:09:52 +08:00 ![]() 并不是想贬低楼主的工作, 但是这类脚手架随便一个前端学个一年都会自己弄出来一套, 所以我至今没见过一套能够足够流行的脚手架. 我觉得没有技术含量的东西, 要能够占领市场, 只有 1 条途径, 就是靠大厂推广. |
![]() | 6 rabbbit 2018-11-09 11:15:28 +08:00 ![]() |
![]() | 7 leinov OP @buhi 我只是整理了一下自己的一个架构方案分享下而已,互联网时代不就是大家再互相学习与知识分享么,你可以否定我的架构,但不要否定我的工作 ok ? 进你主页看了下 吠气很重呀,见谁怼谁 是老天对你不公 还是你对这个社会不满。 |
9 TomatoYuyuko 2018-11-09 11:28:02 +08:00 @rabbbit 好东西啊 我觉得挺适合用来学习 wp 的 |
11 connection 2018-11-09 14:14:59 +08:00 多页应用其实也可以加入 dll 跟 common 利用缓存使用 这样细化的优势较大 |
![]() | 12 for8ever 2018-11-09 14:36:23 +08:00 直接用 next.js 不就完了 |
![]() | 13 leinov OP @connection 好 我研究下 |
![]() | 15 cuzfinal 2018-11-09 15:15:31 +08:00 这和架构没关系吧,一个模板。 |
![]() | 16 Desiree 2018-11-09 15:19:26 +08:00 好东西,支持一下,不过标题有点夸张就是了,「终极架构」 |
![]() | 19 Ixizi 2018-11-09 18:08:29 +08:00 至今不会 webpack |
21 yokyj 2018-11-17 14:36:20 +08:00 强烈安利 umijs |