{"id":19069577,"url":"https://github.com/srect/webpack4.x","last_synced_at":"2026-05-17T04:30:15.868Z","repository":{"id":114173295,"uuid":"179200519","full_name":"sRect/webpack4.x","owner":"sRect","description":"webpack4.x学习","archived":false,"fork":false,"pushed_at":"2019-05-05T09:25:26.000Z","size":869,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-02T15:45:20.651Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sRect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-04-03T03:07:15.000Z","updated_at":"2019-05-05T09:25:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"0007eb75-9155-49c4-aaf6-fc8ae06dbd26","html_url":"https://github.com/sRect/webpack4.x","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sRect%2Fwebpack4.x","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sRect%2Fwebpack4.x/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sRect%2Fwebpack4.x/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sRect%2Fwebpack4.x/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sRect","download_url":"https://codeload.github.com/sRect/webpack4.x/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240122573,"owners_count":19751142,"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":[],"created_at":"2024-11-09T01:14:49.114Z","updated_at":"2026-05-17T04:30:15.779Z","avatar_url":"https://github.com/sRect.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"webpack4.x学习\n---\n![avatar](https://img.shields.io/badge/webpack-4.29.6-blue.svg)\n![avatar](https://img.shields.io/badge/devServer-3.2.1-blue.svg)\n\n### 骨架\n```javascript\nmodule.exports = {\n  entry: {},\n  output: {},\n  module: {},\n  plugins: [],\n  devServer: {},\n  mode: \"development\"\n}\n```\n\n### 配置scripts脚本\n```json\n{\n  \"name\": \"webpack4.x\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"server\": \"webpack-dev-server\",\n    \"build\": \"webpack\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"devDependencies\": {\n    \"webpack\": \"^4.29.6\",\n    \"webpack-cli\": \"^3.3.0\",\n  }\n}\n```\n\n### devServer\n```javascript\nconst path = require('path');\n\nmodule.exports = {\n  entry: {\n    main: './src/index.js'\n  },\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: '[name].js'\n  },\n  devServer: {\n    contentBase: path.resolve(__dirname, 'dist'),\n    port: 3000,\n    compress: true,\n    hot: true,\n    open: true,\n    compress: true,\n    host: 'localhost'\n  },\n  mode: \"development\"\n}\n```\n\n### html-webpack-plugin\n```javascript\nconst path = require('path');\nconst HtmlWebpackPlugin = require('html-webpack-plugin');\n\nmodule.exports = {\n  entry: {\n    main: './src/index.js'\n  },\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: '[name].js'\n  },\n  module: {},\n  plugins: [\n    new HtmlWebpackPlugin({\n      title: 'hello world',\n      hash: true,\n      minify: {\n        collapseWhitespace: true,\n        removeAttributeQuotes: true\n      },\n      template: './index.html'\n    })\n  ],\n  devServer: {\n    contentBase: path.resolve(__dirname, 'dist'),\n    port: 3000,\n    compress: true,\n    hot: true,\n    open: true,\n    compress: true,\n    host: 'localhost'\n  },\n  mode: \"development\"\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrect%2Fwebpack4.x","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrect%2Fwebpack4.x","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrect%2Fwebpack4.x/lists"}