webcontainer-core
webcontainer-core copied to clipboard
Proxy with Angular 17
Describe the bug
Hi,
I have a project that works perfectly with Angular 16 and webcontainers.io However, I just uplated the project to Angular 17 and it doesn't work anymore.
This is the error I have:
[vite] http proxy error: Must provide a proper URL as target
Error: Must provide a proper URL as target
at ProxyServer.<anonymous> (file:///Users/oleplus/lab/prompt-challenge-light/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:62959:36)
at viteProxyMiddleware (file:///Users/oleplus/lab/prompt-challenge-light/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:63273:23)
at call (file:///Users/oleplus/lab/prompt-challenge-light/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:42750:7)
at next (file:///Users/oleplus/lab/prompt-challenge-light/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:42694:5)
at viteCachedTransformMiddleware (file:///Users/oleplus/lab/prompt-challenge-light/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:63421:9)
at call (file:///Users/oleplus/lab/prompt-challenge-light/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:42750:7)
at next (file:///Users/oleplus/lab/prompt-challenge-light/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:42694:5)
at cors (file:///Users/oleplus/lab/prompt-challenge-light/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:43222:7)
at file:///Users/oleplus/lab/prompt-challenge-light/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:43258:17
at originCallback (file:///Users/oleplus/lab/prompt-challenge-light/node_modules/vite/dist/node/chunks/dep-k5wXcrSr.js:43248:15)
This may be due to Angular moving from webpack to vite but I didn't figure out how to fix the issue. I don't have the issue if I remove the proxy configuration but then webcontainers doesn't work anymore because of "SharedArrayBuffers" issue
Here is my proxy confitguration in my angular.json (it hasn't changed when updating the project from Angular 16 to Angular 17)
"options": {
"headers": {
"Cross-Origin-Embedder-Policy": "require-corp",
"Cross-Origin-Opener-Policy": "same-origin"
}
}
Link to the blitz that caused the error
NA
Steps to reproduce
Update a project from Angular 16 to Angular 17
Expected behavior
I expected it to work ^^
Parity with Local
- [X] I have run the project in my local machine and I could not reproduce the issue.
Screenshots
No response
Platform
- OS: macOS
- Browser: Version
- Version: 123.0.6312.122 (Official Build) (arm64)
Additional context
No response