'Rollup proxy configuration causes the short circuit in the client-server

In my rollup.config.js file, I have added the following lines to proxy the requests destined to the client-server to the backend as such:

!production && localdev({
  dirs: ['public'],
  host: 'localhost',
  port: 9876,
  proxy: [{ from: '/api/*', to: 'localhost:8080' }],
}),

, but this causes the server to short circuit and give the prompt below:

yarn run v1.22.11
warning package.json: No license field
$ rollup -c -w
rollup v2.58.0
bundles src/main.ts → public\build\bundle.js...
LiveReload enabled
[2021-10-13 12:03:20] ÔÜí´©Ädev-server proxying from /api/* to localhost:8080
Done in 3.63s.

it should be working until it is explicitly interrupted, though.



Solution 1:[1]

change localhost:8080 to http://localhost:8080. it's bad that it doesn't shout the error.

See https://github.com/sveltejs/svelte/issues/3717 and https://github.com/pearofducks/rollup-plugin-dev

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joel Lim