Skip to content

Commit c12af7a

Browse files
author
Angular Builds
committed
f836be9 fix(@angular/build): support Vite allowedHosts option for development server
1 parent 4a234b5 commit c12af7a

File tree

6 files changed

+21
-16
lines changed

6 files changed

+21
-16
lines changed

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "@angular-devkit/build-angular",
3-
"version": "19.2.0-next.0+sha-eb98bbd",
3+
"version": "19.2.0-next.0+sha-f836be9",
44
"description": "Angular Webpack Build Facade",
55
"main": "src/index.js",
66
"typings": "src/index.d.ts",
77
"builders": "builders.json",
88
"dependencies": {
99
"@ampproject/remapping": "2.3.0",
10-
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#eb98bbd",
11-
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#eb98bbd",
12-
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#eb98bbd",
13-
"@angular/build": "github:angular/angular-build-builds#eb98bbd",
10+
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#f836be9",
11+
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#f836be9",
12+
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#f836be9",
13+
"@angular/build": "github:angular/angular-build-builds#f836be9",
1414
"@babel/core": "7.26.0",
1515
"@babel/generator": "7.26.5",
1616
"@babel/helper-annotate-as-pure": "7.25.9",
@@ -21,7 +21,7 @@
2121
"@babel/preset-env": "7.26.0",
2222
"@babel/runtime": "7.26.0",
2323
"@discoveryjs/json-ext": "0.6.3",
24-
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#eb98bbd",
24+
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#f836be9",
2525
"@vitejs/plugin-basic-ssl": "1.2.0",
2626
"ansi-colors": "4.1.3",
2727
"autoprefixer": "10.4.20",
@@ -70,7 +70,7 @@
7070
"@angular/localize": "^19.0.0 || ^19.2.0-next.0",
7171
"@angular/platform-server": "^19.0.0 || ^19.2.0-next.0",
7272
"@angular/service-worker": "^19.0.0 || ^19.2.0-next.0",
73-
"@angular/ssr": "github:angular/angular-ssr-builds#eb98bbd",
73+
"@angular/ssr": "github:angular/angular-ssr-builds#f836be9",
7474
"@web/test-runner": "^0.19.0",
7575
"browser-sync": "^3.0.2",
7676
"jest": "^29.5.0",
@@ -91,7 +91,7 @@
9191
"@angular/service-worker": {
9292
"optional": true
9393
},
94-
"@angular/ssr": "github:angular/angular-ssr-builds#eb98bbd",
94+
"@angular/ssr": "github:angular/angular-ssr-builds#f836be9",
9595
"@web/test-runner": {
9696
"optional": true
9797
},

src/builders/dev-server/builder.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ function execute(options, context, transforms = {}, extensions) {
8484
}
8585
// New build system defaults hmr option to the value of liveReload
8686
normalizedOptions.hmr ??= normalizedOptions.liveReload;
87+
// New build system uses Vite's allowedHost option convention of true for disabling host checks
88+
if (normalizedOptions.disableHostCheck) {
89+
normalizedOptions.allowedHosts = true;
90+
}
91+
else {
92+
normalizedOptions.allowedHosts ??= [];
93+
}
8794
return (0, rxjs_1.defer)(() => Promise.all([Promise.resolve().then(() => __importStar(require('@angular/build/private'))), Promise.resolve().then(() => __importStar(require('../browser-esbuild')))])).pipe((0, rxjs_1.switchMap)(([{ serveWithVite, buildApplicationInternal }, { convertBrowserOptions }]) => serveWithVite(normalizedOptions, builderName, (options, context, codePlugins) => {
8895
return builderName === '@angular-devkit/build-angular:browser-esbuild'
8996
? // eslint-disable-next-line @typescript-eslint/no-explicit-any

src/builders/dev-server/schema.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
*/
44
export type Schema = {
55
/**
6-
* List of hosts that are allowed to access the dev server. This option has no effect when
7-
* using the 'application' or other esbuild-based builders.
6+
* List of hosts that are allowed to access the dev server.
87
*/
98
allowedHosts?: string[];
109
/**
@@ -14,8 +13,7 @@ export type Schema = {
1413
*/
1514
buildTarget: string;
1615
/**
17-
* Don't verify connected clients are part of allowed hosts. This option has no effect when
18-
* using the 'application' or other esbuild-based builders.
16+
* Don't verify connected clients are part of allowed hosts.
1917
*/
2018
disableHostCheck?: boolean;
2119
/**

src/builders/dev-server/schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
},
6868
"allowedHosts": {
6969
"type": "array",
70-
"description": "List of hosts that are allowed to access the dev server. This option has no effect when using the 'application' or other esbuild-based builders.",
70+
"description": "List of hosts that are allowed to access the dev server.",
7171
"default": [],
7272
"items": {
7373
"type": "string"
@@ -79,7 +79,7 @@
7979
},
8080
"disableHostCheck": {
8181
"type": "boolean",
82-
"description": "Don't verify connected clients are part of allowed hosts. This option has no effect when using the 'application' or other esbuild-based builders.",
82+
"description": "Don't verify connected clients are part of allowed hosts.",
8383
"default": false
8484
},
8585
"hmr": {

src/utils/normalize-cache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
1010
exports.normalizeCacheOptions = normalizeCacheOptions;
1111
const node_path_1 = require("node:path");
1212
/** Version placeholder is replaced during the build process with actual package version */
13-
const VERSION = '19.2.0-next.0+sha-eb98bbd';
13+
const VERSION = '19.2.0-next.0+sha-f836be9';
1414
function hasCacheMetadata(value) {
1515
return (!!value &&
1616
typeof value === 'object' &&

uniqueId

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Thu Jan 23 2025 23:04:45 GMT+0000 (Coordinated Universal Time)
1+
Thu Jan 23 2025 23:56:28 GMT+0000 (Coordinated Universal Time)

0 commit comments

Comments
 (0)