Skip to content

Commit 72c642a

Browse files
author
Angular Builds
committed
ef11781 fix(@angular-devkit/build-angular): allow vite to serve JavaScript and TypeScript assets
1 parent 4fa9cc4 commit 72c642a

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "@angular-devkit/build-angular",
3-
"version": "17.0.6+sha-385eb77",
3+
"version": "17.0.6+sha-ef11781",
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.2.1",
10-
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#385eb77",
11-
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#385eb77",
12-
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#385eb77",
10+
"@angular-devkit/architect": "github:angular/angular-devkit-architect-builds#ef11781",
11+
"@angular-devkit/build-webpack": "github:angular/angular-devkit-build-webpack-builds#ef11781",
12+
"@angular-devkit/core": "github:angular/angular-devkit-core-builds#ef11781",
1313
"@babel/core": "7.23.2",
1414
"@babel/generator": "7.23.0",
1515
"@babel/helper-annotate-as-pure": "7.22.5",
@@ -20,7 +20,7 @@
2020
"@babel/preset-env": "7.23.2",
2121
"@babel/runtime": "7.23.2",
2222
"@discoveryjs/json-ext": "0.5.7",
23-
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#385eb77",
23+
"@ngtools/webpack": "github:angular/ngtools-webpack-builds#ef11781",
2424
"@vitejs/plugin-basic-ssl": "1.0.1",
2525
"ansi-colors": "4.1.3",
2626
"autoprefixer": "10.4.16",

src/builders/dev-server/vite-server.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,10 @@ async function setupServer(serverOptions, outputFiles, assets, preserveSymlinks,
452452
// Rewrite all build assets to a vite raw fs URL
453453
const assetSourcePath = assets.get(pathname);
454454
if (assetSourcePath !== undefined) {
455+
// Workaround to disable Vite transformer middleware.
456+
// See: https://github.com/vitejs/vite/blob/746a1daab0395f98f0afbdee8f364cb6cf2f3b3f/packages/vite/src/node/server/middlewares/transform.ts#L201 and
457+
// https://github.com/vitejs/vite/blob/746a1daab0395f98f0afbdee8f364cb6cf2f3b3f/packages/vite/src/node/server/transformRequest.ts#L204-L206
458+
req.headers.accept = 'text/html';
455459
// The encoding needs to match what happens in the vite static middleware.
456460
// ref: https://github.com/vitejs/vite/blob/d4f13bd81468961c8c926438e815ab6b1c82735e/packages/vite/src/node/server/middlewares/static.ts#L163
457461
req.url = `${server.config.base}@fs/${encodeURI(assetSourcePath)}`;

uniqueId

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Tue Dec 12 2023 15:08:49 GMT+0000 (Coordinated Universal Time)
1+
Tue Dec 12 2023 16:48:06 GMT+0000 (Coordinated Universal Time)

0 commit comments

Comments
 (0)