{"id":25456126,"url":"https://github.com/wujunchuan/generator-core","last_synced_at":"2025-07-07T07:12:06.415Z","repository":{"id":93373070,"uuid":"106654484","full_name":"wujunchuan/generator-core","owner":"wujunchuan","description":"The demonstration code of predictable long term caching with Webpack ","archived":false,"fork":false,"pushed_at":"2017-10-25T01:38:00.000Z","size":294,"stargazers_count":13,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-09T01:35:37.999Z","etag":null,"topics":["config","configuration","generator","long-tern-cache","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wujunchuan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-12T06:38:59.000Z","updated_at":"2021-07-13T06:43:49.000Z","dependencies_parsed_at":"2023-03-29T05:31:34.740Z","dependency_job_id":null,"html_url":"https://github.com/wujunchuan/generator-core","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wujunchuan/generator-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wujunchuan%2Fgenerator-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wujunchuan%2Fgenerator-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wujunchuan%2Fgenerator-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wujunchuan%2Fgenerator-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wujunchuan","download_url":"https://codeload.github.com/wujunchuan/generator-core/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wujunchuan%2Fgenerator-core/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264032305,"owners_count":23546808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","configuration","generator","long-tern-cache","webpack"],"created_at":"2025-02-18T01:29:12.632Z","updated_at":"2025-07-07T07:12:06.409Z","avatar_url":"https://github.com/wujunchuan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 项目搭建记录\n\n### 初衷\n\n  在代码中依赖的库很少会去主动升级版本,而自己的业务代码却每时每刻在变更,因此我们可以考虑将依赖的库的代码与自己的代码分割开来,这样用户在下一次使用的时候就可以尽量避免重复下载没有变更的代码\n\n### 设想的几种模式\n\n  -  热更新开发模式(`npm run start`): 这种模式下看不到Webpack编译输出的文件,所有文件的读取都是在内存中进行。通过使用模块热替换(HRM) ,允许在开发中更新各种模块,而无需进行完全的刷新。\n\n  -  测试开发模式(`npm run test-dev`): 用来检查**Webpack编译输出的文件是否正确**\n\n  -  发布模式(`npm run build`): 打包编译静态资源文件到`dist/`目录,替换资源引用路径为CDN路径\n\n### 分离Webpack配置文件\n\n  由于webpack在开发和生产环境中经常需要做各种配置的切换，官方也提供了DefinePlugin来进行环境参数设置，但是大量的判断语句侵入webpack.config中其实会导致代码的可读性和复用性变差，也容易造成代码冗余，我们在此可以对配置文件进行重构，将之前的webpack配置文件拆解成了`webpack.bse.config.js`，和`webpack.dev.config.js`,`webpack.config.js`三个文件，三个文件各司其职，又可互相协作，减少维护成本\n\n# 下一步计划\n\n实现一个通用模板,接入Yeoman,做成可定制化的脚手架。\n\n# 参考\n\n[Express结合Webpack的全栈自动刷新](http://acgtofe.com/posts/2016/02/full-live-reload-for-express-with-webpack)\n\n[koala前端-Webpack构建之hash缓存的利用](https://blog.kaolafed.com/2017/04/26/webpack%E6%9E%84%E5%BB%BA%E4%B9%8Bhash%E7%BC%93%E5%AD%98%E7%9A%84%E5%88%A9%E7%94%A8/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwujunchuan%2Fgenerator-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwujunchuan%2Fgenerator-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwujunchuan%2Fgenerator-core/lists"}