{"id":14976477,"url":"https://github.com/jiucheng-front/dev-webpack","last_synced_at":"2025-10-27T20:31:54.489Z","repository":{"id":126944415,"uuid":"94973030","full_name":"jiucheng-front/dev-webpack","owner":"jiucheng-front","description":":cn: Webpack config","archived":false,"fork":false,"pushed_at":"2020-04-28T02:27:40.000Z","size":4894,"stargazers_count":17,"open_issues_count":0,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-01T08:05:52.451Z","etag":null,"topics":["es6","javascript","less","markdown","pug","pug-loader","sass","stylus","typescript","webpack3"],"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/jiucheng-front.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-06-21T06:56:30.000Z","updated_at":"2023-04-11T03:43:50.000Z","dependencies_parsed_at":"2023-06-19T04:38:34.374Z","dependency_job_id":null,"html_url":"https://github.com/jiucheng-front/dev-webpack","commit_stats":{"total_commits":119,"total_committers":2,"mean_commits":59.5,"dds":0.134453781512605,"last_synced_commit":"ff93b6dd8ec1833f51a46cddf5aa2e71e837b96a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiucheng-front%2Fdev-webpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiucheng-front%2Fdev-webpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiucheng-front%2Fdev-webpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiucheng-front%2Fdev-webpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jiucheng-front","download_url":"https://codeload.github.com/jiucheng-front/dev-webpack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238553223,"owners_count":19491392,"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":["es6","javascript","less","markdown","pug","pug-loader","sass","stylus","typescript","webpack3"],"created_at":"2024-09-24T13:53:56.761Z","updated_at":"2025-10-27T20:31:49.142Z","avatar_url":"https://github.com/jiucheng-front.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 一、如何使用(注意webpack的版本，最新版本有部分更新导致无法运行，详细参考官方)\n+ \u003ccode\u003enpm install\u003c/code\u003e\n+ \u003ccode\u003enpm run dev\u003c/code\u003e\n+ \u003ccode\u003enpm run build \u003c/code\u003e\n\n\n### 二、已经完成的配置\n+ 1、webpack-dev-server 热更新\n+ 2、编译LESS、SCSS、Stylus、es6\n+ 3、打包自动追加文件版本号(hash)\n+ 4、html自定义模板\n+ 5、抽离、压缩CSS\n+ 6、压缩、提取JS\n+ 7、url-loader处理图片为base64，使用时图片必须是相对路径否则无效(**一般不用**)\n+ 8、external外部配置文件(开发依赖)，例如：项目用到jQuery(**有vendor该项省略**)\n+ 9、vendors(提取第三方JS库或者公用代码，如JQ、手淘lib-flexible)\n\t+ 这样每次逻辑代码更新，第三方库的版本不会更新可以缓存(提高性能)\n+ 10、markDown文件自动转为html(类似github内的README.md默认样式)\n+ 11、添加pug、和pug-loader处理html组件化\n+ 12、CSS、LESS、SCSS、Stylus自动追加浏览器前缀(node-sass经常安装失败建议放弃)\n+ 13、CSS模块化即CSS内使用\u003ccode\u003e@import 其他CSS文件\u003c/code\u003e\n+ 14、CSS内使用CSS3+新语法\n+ 15、压缩打包后的html文件\n+ 16、异步组件(原理：动态向head插入script标签)\n\t+ \u003ccode\u003echunkFilename\u003c/code\u003e\n\t+ \u003ccode\u003erequire.ensure\u003c/code\u003e\n\n\n### 三、文件目录介绍\n+ config 打包输出配置\n+ webpack.confog.js被拆分为dev、common、prod三部分\n+ src：主要操作都在这里\n\t+ js/css活动所需要的公用JS和CSS\n\t+ root服务器根目录\n+  postcss.config.js：postcss配置文件\n\t+  \u003ccode\u003epostcss-import、postcss-cssnext、\u003c/code\u003e\n\t+  autoprefixer已经内置到postcss-cssnext\n+ .babelrc :编译es6的配置\n+ .gitignore：github提交的时候想要忽略提交的配置\n+  package.json：项目所需要的依赖包以及配置说明。\n+ .html和.ejs都是HTML模板样式，最终会自动添加到指定目录内\n\n### 四、webpack中如何使用typeScript\n+ npm install -D typescript\n+ npm install -D ts-loader@3.1.1 //webpack4.0之前用低版本的loader\n+ 配置tsconfig.json\n+ rule中添加编译ts/tsx编译选项\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiucheng-front%2Fdev-webpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiucheng-front%2Fdev-webpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiucheng-front%2Fdev-webpack/lists"}