{"_id":"@deluksic/vite-plugin-proxy-middleware","_rev":"1-ef1346cdc2452f807add6c499c96f384","name":"@deluksic/vite-plugin-proxy-middleware","dist-tags":{"alpha":"1.1.0","latest":"1.1.1"},"versions":{"1.1.0":{"name":"@deluksic/vite-plugin-proxy-middleware","version":"1.1.0","description":"a vite plugin that solve the conflict problem between turning on vite proxy and http2, you can use both http2 and proxy at the same time ;-)","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/williamyorkl/vite-plugin-proxy-middleware.git"},"author":"","license":"ISC","bugs":{"url":"https://github.com/williamyorkl/vite-plugin-proxy-middleware/issues"},"homepage":"https://github.com/williamyorkl/vite-plugin-proxy-middleware#readme","dependencies":{"chalk":"^4.1.2","http2-proxy":"^5.0.53"},"peerDependencies":{"vite":"^4.3.0"},"devDependencies":{"@types/node":"^20.3.2","@rollup/plugin-terser":"^0.4.3","@rollup/plugin-typescript":"^11.1.1","rollup":"^3.25.3","tslib":"^2.6.0","typescript":"^5.1.3"},"types":"./dist/index.d.ts","scripts":{"build":"rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript"},"_id":"@deluksic/vite-plugin-proxy-middleware@1.1.0","_integrity":"sha512-RM2mYnxwK+4ZjkWOnh5lZm1bc/1DfmtVW5nAs5uZFO6Y0xWF7WVQALs172S1YueSN6bEEzYG0PPlBvxsYzG+/w==","_resolved":"/private/var/folders/1g/bmcshrln2ndcxdvkdxwfvwr40000gn/T/bef38b20520792758382f75d010dfc37/deluksic-vite-plugin-proxy-middleware-1.1.0.tgz","_from":"file:deluksic-vite-plugin-proxy-middleware-1.1.0.tgz","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-RM2mYnxwK+4ZjkWOnh5lZm1bc/1DfmtVW5nAs5uZFO6Y0xWF7WVQALs172S1YueSN6bEEzYG0PPlBvxsYzG+/w==","shasum":"88a2f88b168f104079f6da94dfb3b525f010240c","tarball":"https://registry.npmjs.org/@deluksic/vite-plugin-proxy-middleware/-/vite-plugin-proxy-middleware-1.1.0.tgz","fileCount":10,"unpackedSize":12847,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDmwy6uvfJB8LSFuCEZGT91eD5mj3gmxp9H48moHKzrvQIhALUwY0ZtaM98Hv9gRqOgwWy4ApYLHEtADFj0N8H2Ic1z"}]},"_npmUser":{"name":"deluksic","email":"deluksic@gmail.com"},"directories":{},"maintainers":[{"name":"deluksic","email":"deluksic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-proxy-middleware_1.1.0_1687939821109_0.7711997183682355"},"_hasShrinkwrap":false},"1.1.1":{"name":"@deluksic/vite-plugin-proxy-middleware","version":"1.1.1","description":"a vite plugin that solve the conflict problem between turning on vite proxy and http2, you can use both http2 and proxy at the same time ;-)","main":"dist/index.js","repository":{"type":"git","url":"git+https://github.com/williamyorkl/vite-plugin-proxy-middleware.git"},"author":"","license":"ISC","bugs":{"url":"https://github.com/williamyorkl/vite-plugin-proxy-middleware/issues"},"homepage":"https://github.com/williamyorkl/vite-plugin-proxy-middleware#readme","dependencies":{"chalk":"^4.1.2","http2-proxy":"^5.0.53"},"peerDependencies":{"vite":"^4.3.0"},"devDependencies":{"@types/node":"^20.3.2","@rollup/plugin-terser":"^0.4.3","@rollup/plugin-typescript":"^11.1.1","rollup":"^3.25.3","tslib":"^2.6.0","typescript":"^5.1.3"},"types":"./dist/index.d.ts","scripts":{"build":"rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript"},"_id":"@deluksic/vite-plugin-proxy-middleware@1.1.1","_integrity":"sha512-v34uMZngiXJJ6dGfCRp6tScmYlduf12bVg3syRtKB4KUz3LhFiFQL79pKQpgS42UilWHbKlJyckhlyzzmNxT8A==","_resolved":"/private/var/folders/1g/bmcshrln2ndcxdvkdxwfvwr40000gn/T/dc38045b982dd494257f97d88280dd86/deluksic-vite-plugin-proxy-middleware-1.1.1.tgz","_from":"file:deluksic-vite-plugin-proxy-middleware-1.1.1.tgz","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-v34uMZngiXJJ6dGfCRp6tScmYlduf12bVg3syRtKB4KUz3LhFiFQL79pKQpgS42UilWHbKlJyckhlyzzmNxT8A==","shasum":"228af8aa182e469d8b68001f8ba1c698bc25496a","tarball":"https://registry.npmjs.org/@deluksic/vite-plugin-proxy-middleware/-/vite-plugin-proxy-middleware-1.1.1.tgz","fileCount":10,"unpackedSize":12969,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGMYnrGZqTefOg5VDV7Njp2MLNTwJPN2NGlkLdhaxMy+AiEA621uT5OGN5hBGbSUVZDaOfYYeEG9+qdWgfo3jhm8vL4="}]},"_npmUser":{"name":"deluksic","email":"deluksic@gmail.com"},"directories":{},"maintainers":[{"name":"deluksic","email":"deluksic@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vite-plugin-proxy-middleware_1.1.1_1688545900105_0.934668462004544"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-28T08:10:21.048Z","1.1.0":"2023-06-28T08:10:21.243Z","modified":"2023-07-05T08:31:40.382Z","1.1.1":"2023-07-05T08:31:40.268Z"},"maintainers":[{"name":"deluksic","email":"deluksic@gmail.com"}],"description":"a vite plugin that solve the conflict problem between turning on vite proxy and http2, you can use both http2 and proxy at the same time ;-)","homepage":"https://github.com/williamyorkl/vite-plugin-proxy-middleware#readme","repository":{"type":"git","url":"git+https://github.com/williamyorkl/vite-plugin-proxy-middleware.git"},"bugs":{"url":"https://github.com/williamyorkl/vite-plugin-proxy-middleware/issues"},"license":"ISC","readme":"# vite-plugin-proxy-middleware\n\na vite plugin that solve the conflict problem between turning on vite proxy and http2, you can use both http2 and proxy at the same time ;-)\n\nReason for the limitation between `h2` and `proxy` are saying explicitly on Vite's website:\nhttps://vitejs.dev/config/#server-https\n\n<br/>\n\n## Usage\n\n#### 1. Install\n\n```bash\nnpm i vite-plugin-proxy-middleware -D\n```\n\n#### 2. Add it to `vite.config.js`\n\n```js\n// vite.config.js\nimport { createVuePlugin } from \"vite-plugin-vue2\";\nimport VitePluginProxyMiddleware from \"vite-plugin-proxy-middleware\";\n\nconst path = require(\"path\");\n\nexport default {\n  plugins: [\n    createVuePlugin(),\n    VitePluginProxyMiddleware({\n      proxyTable: path.resolve(__dirname, \"./proxy-table\"),\n    }),\n  ],\n  server: {\n    /* https option must be turned on,so that you can use h2 */\n    https: {\n      key: \"./cert/xxx.cert\",\n      cert: \"./cert/xxx.key\",\n    },\n\n    /* vite's original proxy must be ignored,or else it will impact on h2 setting turning on */\n    // proxy: xxx,\n  },\n};\n```\n\n#### 3. Config your proxy table setting to the option: `proxyTable`\n\n```js\n// vite proxy table example\n\nmodule.exports = {\n  dev: {\n    \"/admin\": {\n      target: \"http://xxx-dev.com/\",\n      rewrite: (path) => path.replace(/^\\/admin/, \"\"),\n    },\n  },\n  test: {\n    \"/admin\": {\n      target: \"http://xxx-test.com/\",\n      rewrite: (path) => path.replace(/^\\/admin/, \"\"),\n    },\n  },\n  gray: {\n    \"/admin\": {\n      target: \"http://xxx-gray.com\",\n      rewrite: (path) => path.replace(/^\\/admin/, \"\"),\n    },\n  },\n  prod: {\n    \"/admin\": {\n      target: \"http://xxx-prod.com\",\n      rewrite: (path) => path.replace(/^\\/admin/, \"\"),\n    },\n  },\n};\n```\n\n#### 4. Generate a SSL certificate\n\n> What's more important, please generate a SSL certificate to ensure that your `https` protocols works locally, only if your `https` works, so that you can use http2\n\nHow to generate a local SSL certificate：\n\n1. https://github.com/FiloSottile/mkcert\n\n2. https://www.jianshu.com/p/7cb5c2cffaaa\n\n#### 5. Some the other options for reference\n\n```ts\ninterface userOptsType {\n  /** if you are using mock, specify a mockPath, default value is '/dev-mock',  */\n  mockPath?: string;\n\n  /** proxyTable can be a proxyTable.js path string or proxyTable object  */\n  proxyTable: proxyTableType;\n\n  /** public host config (if you have a host name for your develop environment,such as \"xxx-dev.xxx.com\", you can set it here, which will be much easier for your to click the link and open the page on browser)  */\n  publicHost?: string;\n}\n```\n\n#### 6. That's all\n\n<br/>\n\n## License\n\nMIT License © 2021 [williamyorkl](https://github.com/williamyorkl)\n","readmeFilename":"README.md"}