Repository navigation
Conversation
…ve to the workspace root The Vite-based dev server read `sslKey` and `sslCert` relative to the current working directory, so serving failed with `ENOENT` when `ng serve` ran from a subdirectory of the workspace and the paths in `angular.json` were relative. Resolve both paths against the workspace root, as the webpack dev server already does. The new dev-server `ssl` spec covers relative paths. It fails with `ENOENT` without this change.
There was a problem hiding this comment.
This should be done in https://github.com/angular/angular-cli/blob/main/packages/angular/build/src/builders/dev-server/options.ts
Similar to
andThere was a problem hiding this comment.
Code Review
This pull request updates the Vite dev-server configuration to resolve the sslCert and sslKey paths relative to the workspace root. Additionally, a new test suite has been added to verify this behavior. There are no review comments, and I have no feedback to provide.
… relative to the workspace root
… relative to the workspace root
0ae6773 to
08e9727
Compare
clydin
left a comment
There was a problem hiding this comment.
This breaks legitimate use cases such as:
ng serve --ssl --ssl-key "$HOME/.certs/key.pem" --ssl-cert "$HOME/.certs/cert.pem"
… relative to the workspace root
| ssl, | ||
| sslCert, | ||
| sslKey, | ||
| sslCert: sslCert && path.resolve(workspaceRoot, sslCert), |
There was a problem hiding this comment.
build-angular dev-server with esbuild target doesnt pass through here - it has own normalizeOptions in packages/angular_devkit/build_angular/src/builders/dev-server/options.ts and hands sslCert/sslKey as is to serveWithVite
so ng serve from project dir with relative ssl paths still fails for build-angular users
first version in vite/server.ts covered both builders, same two lines in that file would keep them in sync
sslCert: sslCert && path.resolve(workspaceRoot, sslCert),
sslKey: sslKey && path.resolve(workspaceRoot, sslKey),
The Vite-based dev server read
sslKeyandsslCertrelative to the current working directory, so serving failed withENOENTwhenng serveran from a subdirectory of the workspace and the paths inangular.jsonwere relative. Resolve both paths against the workspace root, as the webpack dev server already does.