Error on dev server start
Opened this issue · 1 comments
LAXITKUMAR commented
Getting following error on start:
error when starting dev server:
TypeError: Cannot read property '0' of undefined
at t.use.viteProtocol (/Users/klaxit/Documents/GitHub/git-wt-ui-vite-master/node_modules/vite-plugin-proxy-middleware/dist/index.js:1:3123)
at configureServer (/Users/klaxit/Documents/GitHub/git-wt-ui-vite-master/node_modules/vite-plugin-proxy-middleware/dist/index.js:1:3481)
at createServer (file:///Users/klaxit/Documents/GitHub/git-wt-ui-vite-master/node_modules/vite/dist/node/chunks/dep-3007b26d.js:61302:30)
at async CAC.<anonymous> (file:///Users/klaxit/Documents/GitHub/git-wt-ui-vite-master/node_modules/vite/dist/node/cli.js:734:24)
OS: MacOS Ventura 13.0.1
Node version: 14.18.3
"vite-plugin-proxy-middleware": "^1.0.2"
"vite": "^4.1.1",
Proxy-table: content
module.exports = {
"/api": {
https: true,
target: "https://<SomeIp>",
rewrite: path => path,
secure: false,
changeOrigin: true,
},
};
config added in plugin section
VitePluginProxyMiddleware({
proxyTable: resolve(__dirname, "./proxy-table"),
}),
Vite server configuration
server: {
port: 8000,
https: {
key: "./.cert/key.pem",
cert: "./.cert/cert.pem",
},
},
leobaixinxin commented
you can change it like this, try it
VitePluginProxyMiddleware({
proxyTable: {
"/api": {
https: true,
target: "https://",
rewrite: path => path,
secure: false,
changeOrigin: true,
},
},
}),