{"id":20388563,"url":"https://github.com/efureev/webpack-plugin-server-push","last_synced_at":"2025-04-12T10:42:17.379Z","repository":{"id":40421871,"uuid":"354039581","full_name":"efureev/webpack-plugin-server-push","owner":"efureev","description":"Create Nginx conf for assets bundle for Server Push (http2)","archived":false,"fork":false,"pushed_at":"2022-05-09T17:56:00.000Z","size":23,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T05:33:22.438Z","etag":null,"topics":["server-push","webpack-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/efureev.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}},"created_at":"2021-04-02T14:15:15.000Z","updated_at":"2022-10-27T10:25:16.000Z","dependencies_parsed_at":"2022-08-09T20:00:38.893Z","dependency_job_id":null,"html_url":"https://github.com/efureev/webpack-plugin-server-push","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efureev%2Fwebpack-plugin-server-push","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efureev%2Fwebpack-plugin-server-push/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efureev%2Fwebpack-plugin-server-push/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/efureev%2Fwebpack-plugin-server-push/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/efureev","download_url":"https://codeload.github.com/efureev/webpack-plugin-server-push/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248557169,"owners_count":21124156,"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":["server-push","webpack-plugin"],"created_at":"2024-11-15T03:11:29.989Z","updated_at":"2025-04-12T10:42:17.347Z","avatar_url":"https://github.com/efureev.png","language":"TypeScript","readme":"# Server Push Webpack Plugin\n\nThis plugin creates configs for HTTP/2 Server Push for Nginx and other web-server.\n\n## Install\n\n```sh\nyarn add -D @feugene/webpack-plugin-server-push\n# or \nnpm install -D @feugene/webpack-plugin-server-push\n```\n\n\n## Using\n\n### Example #1: webpack.config.js\n\n```js\n// vue.config.js\nconst ServerPushWebpackPlugin = require('@feugene/webpack-plugin-server-push').default\n\nconst vueConfig = {\n    publicPath: '/',\n    outputDir: 'dist',\n    assetsDir: 'static',\n    productionSourceMap: false,\n    configureWebpack: {\n        resolve: {\n            alias: {\n                '@': resolve('src'),\n            },\n        },\n        plugins: [\n            new ServerPushWebpackPlugin({\n              target: 'nginx',\n              options: {\n                omitLocation: true,\n                filename: 'nginx.server-push.conf',\n              },\n            })\n        ],\n    }\n}\n\nmodule.exports = vueConfig\n```\n\nThis will generate a file dist/nginx.server-push.conf containing the following:\n```conf\n    http2_push /static/css/app.f908c0a3.css;\n    http2_push /static/js/app.20460db2.js;\n    http2_push /static/css/chunk-elementUI.5e0028e4.css;\n    http2_push /static/js/chunk-elementUI.0911e193.js;\n    http2_push /static/js/chunk-libs.06f73890.js;\n```\n\nInclude the generated `nginx.server-push.conf` into your nginx config. For example:\n```conf\nserver {\n    server_name mockery.dev;\n\n\tlisten 443 ssl http2;\n\n\tssl_certificate /usr/share/cert/server/servercert.pem;\n    ssl_certificate_key /usr/share/cert/server/serverkey.pem;\n\t\t\n    location / {\n\t\tinclude nginx.server-push.conf;\n\n        proxy_pass http://127.0.0.1:1115;\n        proxy_redirect off;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_read_timeout 60s;\n        proxy_connect_timeout 60s;\n    }\n}\n\n```\n\n### Example #2: webpack.config.js\n\n```js\n// webpack.config.js\nconst ServerPushWebpackPlugin = require('@feugene/webpack-plugin-server-push').default\n\nmodule.exports = {\n  entry: 'index.js',\n  output: {\n    path: __dirname + '/dist',\n    publicPath: '/',\n    filename: 'index_bundle.js'\n  },\n  plugins: [\n    new ServerPushWebpackPlugin({ target:'nginx', options:{index: 'index.html' }})\n  ]\n}\n```\n\nThis will generate a file dist/nginx.push.conf containing the following:\n```conf\n\nlocation = / {\n  http2_push /index_bundle.js;\n}\n```\n\nInclude the generated `nginx.push.conf` in main `nginx.conf` as below:\n```conf\nserver {\n    # listen on port 433 with https\n    listen 443 ssl http2;\n\n    server_name example.com;\n\n    # ssl cert\n    ssl_certificate /usr/share/cert/server/servercert.pem;\n    ssl_certificate_key /usr/share/cert/server/serverkey.pem;\n\n    # where the root here\n    root /usr/share/app;\n\n    # what file to server as index\n    index index.html;\n\n    # include nginx push conf to enable HTTP/2 server push\n    include nginx.push.conf;\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefureev%2Fwebpack-plugin-server-push","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fefureev%2Fwebpack-plugin-server-push","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fefureev%2Fwebpack-plugin-server-push/lists"}