@nx/angular-rspack 21.0.3 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/config/config-utils/browser-config.d.ts.map +1 -1
- package/dist/lib/config/config-utils/browser-config.js +5 -1
- package/dist/lib/config/config-utils/common-config.d.ts.map +1 -1
- package/dist/lib/config/config-utils/common-config.js +4 -3
- package/dist/lib/config/config-utils/dev-server-config-utils.js +2 -1
- package/dist/lib/config/config-utils/server-config.d.ts.map +1 -1
- package/dist/lib/config/config-utils/server-config.js +5 -1
- package/dist/lib/plugins/tools/worker-pool.d.ts.map +1 -1
- package/dist/lib/plugins/tools/worker-pool.js +0 -3
- package/dist/lib/utils/stats.d.ts.map +1 -1
- package/package.json +6 -12
- package/dist/lib/ssr/server.d.ts +0 -13
- package/dist/lib/ssr/server.d.ts.map +0 -1
- package/dist/lib/ssr/server.js +0 -47
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/browser-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,oCAAoC,EACrC,MAAM,cAAc,CAAC;AAQtB,wBAAsB,gBAAgB,CACpC,iBAAiB,EAAE,oCAAoC,EACvD,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"browser-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/browser-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,oCAAoC,EACrC,MAAM,cAAc,CAAC;AAQtB,wBAAsB,gBAAgB,CACpC,iBAAiB,EAAE,oCAAoC,EACvD,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,aAAa,CAAC,CAgFxB"}
|
|
@@ -15,7 +15,7 @@ async function getBrowserConfig(normalizedOptions, i18n, hashFormat, defaultConf
|
|
|
15
15
|
return {
|
|
16
16
|
...defaultConfig,
|
|
17
17
|
name: 'browser',
|
|
18
|
-
target: 'web',
|
|
18
|
+
target: ['web', 'es2015'],
|
|
19
19
|
entry: {
|
|
20
20
|
main: {
|
|
21
21
|
import: [
|
|
@@ -37,6 +37,10 @@ async function getBrowserConfig(normalizedOptions, i18n, hashFormat, defaultConf
|
|
|
37
37
|
chunkFilename: `[name]${hashFormat.chunk}.js`,
|
|
38
38
|
...(isDevServer ? {} : { scriptType: 'module', module: true }),
|
|
39
39
|
},
|
|
40
|
+
resolve: {
|
|
41
|
+
...defaultConfig.resolve,
|
|
42
|
+
mainFields: ['es2020', 'es2015', 'browser', 'module', 'main'],
|
|
43
|
+
},
|
|
40
44
|
optimization: (0, optimization_config_1.getOptimization)(normalizedOptions, 'browser'),
|
|
41
45
|
module: {
|
|
42
46
|
...defaultConfig.module,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/common-config.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,UAAU,EACV,WAAW,EACX,oCAAoC,EACrC,MAAM,cAAc,CAAC;AAQtB,wBAAsB,eAAe,CACnC,iBAAiB,EAAE,oCAAoC,EACvD,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,EAC/B,UAAU,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"common-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/common-config.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,UAAU,EACV,WAAW,EACX,oCAAoC,EACrC,MAAM,cAAc,CAAC;AAQtB,wBAAsB,eAAe,CACnC,iBAAiB,EAAE,oCAAoC,EACvD,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,EAC/B,UAAU,EAAE,UAAU,iDA6JvB"}
|
|
@@ -12,7 +12,6 @@ const watch_file_logs_plugin_1 = require("../../plugins/watch-file-logs-plugin")
|
|
|
12
12
|
const get_index_input_file_1 = require("../../utils/index-file/get-index-input-file");
|
|
13
13
|
async function getCommonConfig(normalizedOptions, i18n, i18nHash, hashFormat) {
|
|
14
14
|
const isDevServer = process.env['WEBPACK_SERVE'];
|
|
15
|
-
const isProduction = process.env['NODE_ENV'] === 'production';
|
|
16
15
|
const crossOriginLoading = (0, helpers_1.getCrossOriginLoading)(normalizedOptions);
|
|
17
16
|
const sourceMapOptions = (0, sourcemap_utils_1.configureSourceMap)(normalizedOptions.sourceMap);
|
|
18
17
|
const stylesConfig = await (0, style_config_utils_1.getStylesConfig)(normalizedOptions, hashFormat, normalizedOptions.hasServer ? 'server' : 'browser');
|
|
@@ -27,7 +26,10 @@ async function getCommonConfig(normalizedOptions, i18n, i18nHash, hashFormat) {
|
|
|
27
26
|
const defaultConfig = {
|
|
28
27
|
context: normalizedOptions.root,
|
|
29
28
|
profile: normalizedOptions.statsJson,
|
|
30
|
-
mode:
|
|
29
|
+
mode: normalizedOptions.optimization.scripts ||
|
|
30
|
+
normalizedOptions.optimization.styles.minify
|
|
31
|
+
? 'production'
|
|
32
|
+
: 'development',
|
|
31
33
|
devtool: normalizedOptions.sourceMap.scripts ? 'source-map' : false,
|
|
32
34
|
infrastructureLogging: {
|
|
33
35
|
appendOnly: false,
|
|
@@ -53,7 +55,6 @@ async function getCommonConfig(normalizedOptions, i18n, i18nHash, hashFormat) {
|
|
|
53
55
|
extensions: ['.ts', '.tsx', '.mjs', '.js'],
|
|
54
56
|
symlinks: !normalizedOptions.preserveSymlinks,
|
|
55
57
|
modules: ['node_modules'],
|
|
56
|
-
mainFields: ['es2020', 'es2015', 'browser', 'module', 'main'],
|
|
57
58
|
conditionNames: ['es2020', 'es2015', '...'],
|
|
58
59
|
tsConfig: {
|
|
59
60
|
configFile: normalizedOptions.tsConfig,
|
|
@@ -180,7 +180,8 @@ async function getProxyConfig(root, proxyConfig) {
|
|
|
180
180
|
}
|
|
181
181
|
catch (e) {
|
|
182
182
|
assertIsError(e);
|
|
183
|
-
if (e.code !== 'ERR_REQUIRE_ESM'
|
|
183
|
+
if (e.code !== 'ERR_REQUIRE_ESM' &&
|
|
184
|
+
e.code !== 'ERR_REQUIRE_ASYNC_MODULE') {
|
|
184
185
|
throw e;
|
|
185
186
|
}
|
|
186
187
|
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/server-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAA4B,MAAM,cAAc,CAAC;AAE5E,OAAO,KAAK,EACV,WAAW,EACX,oCAAoC,EACrC,MAAM,cAAc,CAAC;AAOtB,wBAAsB,eAAe,CACnC,iBAAiB,EAAE,oCAAoC,EACvD,IAAI,EAAE,WAAW,EACjB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../../../src/lib/config/config-utils/server-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAA4B,MAAM,cAAc,CAAC;AAE5E,OAAO,KAAK,EACV,WAAW,EACX,oCAAoC,EACrC,MAAM,cAAc,CAAC;AAOtB,wBAAsB,eAAe,CACnC,iBAAiB,EAAE,oCAAoC,EACvD,IAAI,EAAE,WAAW,EACjB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,aAAa,CAAC,CAmFxB"}
|
|
@@ -16,7 +16,7 @@ async function getServerConfig(normalizedOptions, i18n, defaultConfig) {
|
|
|
16
16
|
...defaultConfig,
|
|
17
17
|
dependencies: ['browser'],
|
|
18
18
|
name: 'server',
|
|
19
|
-
target: 'node',
|
|
19
|
+
target: ['node', 'es2015'],
|
|
20
20
|
entry: {
|
|
21
21
|
server: {
|
|
22
22
|
import: [
|
|
@@ -37,6 +37,10 @@ async function getServerConfig(normalizedOptions, i18n, defaultConfig) {
|
|
|
37
37
|
chunkFilename: '[name].js',
|
|
38
38
|
library: { type: 'commonjs' },
|
|
39
39
|
},
|
|
40
|
+
resolve: {
|
|
41
|
+
...defaultConfig.resolve,
|
|
42
|
+
mainFields: ['es2020', 'es2015', 'module', 'main'],
|
|
43
|
+
},
|
|
40
44
|
devServer: await (0, dev_server_config_utils_1.getDevServerConfig)(normalizedOptions, 'server'),
|
|
41
45
|
externals: normalizedOptions.externalDependencies,
|
|
42
46
|
optimization: (0, optimization_config_1.getOptimization)(normalizedOptions, 'server'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-pool.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/tools/worker-pool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzE,qBAAa,UAAW,SAAQ,OAAO;gBACzB,OAAO,EAAE,iBAAiB;
|
|
1
|
+
{"version":3,"file":"worker-pool.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/tools/worker-pool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAEzE,qBAAa,UAAW,SAAQ,OAAO;gBACzB,OAAO,EAAE,iBAAiB;CAUvC"}
|
|
@@ -14,9 +14,6 @@ class WorkerPool extends piscina_1.Piscina {
|
|
|
14
14
|
const piscinaOptions = {
|
|
15
15
|
minThreads: 1,
|
|
16
16
|
idleTimeout: 1000,
|
|
17
|
-
// Web containers do not support transferable objects with receiveOnMessagePort which
|
|
18
|
-
// is used when the Atomics based wait loop is enable.
|
|
19
|
-
useAtomics: !process.versions.webcontainer,
|
|
20
17
|
recordTiming: false,
|
|
21
18
|
...options,
|
|
22
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/stats.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,sBAAsB,EAGvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,YAAY,EACb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oCAAoC,EACpC,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAMjD,MAAM,WAAW,qBAAqB;IACpC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,aAAa,CAAC,OAAO,CAAC,EACtB,MAAM,GAAG,OAAO,GAAG,SAAS,CAC7B,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,gBAAgB,EAAE,kBAAkB,EAAE,EACtC,iBAAiB,EAAE,MAAM,GACxB,oBAAoB,EAAE,CAmBxB;AA+HD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,kBAAkB,GAC9B,MAAM,CAsDR;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,kBAAkB,GAC9B,MAAM,CA4DR;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAI9D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAIhE;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,oCAAoC,
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/stats.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,sBAAsB,EAGvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,YAAY,EACb,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oCAAoC,EACpC,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAMjD,MAAM,WAAW,qBAAqB;IACpC,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,aAAa,CAAC,OAAO,CAAC,EACtB,MAAM,GAAG,OAAO,GAAG,SAAS,CAC7B,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,gBAAgB,EAAE,kBAAkB,EAAE,EACtC,iBAAiB,EAAE,MAAM,GACxB,oBAAoB,EAAE,CAmBxB;AA+HD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,kBAAkB,GAC9B,MAAM,CAsDR;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,kBAAkB,GAC9B,MAAM,CA4DR;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAI9D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAIhE;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,oCAAoC,IAQrC,UAAK,EAAE,WAAM,UActB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,OAAO,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,oCAAoC,GAC5C,eAAe,CAoDjB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,YAAY,EACzB,cAAc,CAAC,EAAE,sBAAsB,EAAE,GACxC,IAAI,CAgBN"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular-rspack",
|
|
3
|
-
"version": "21.0
|
|
3
|
+
"version": "21.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -41,10 +41,6 @@
|
|
|
41
41
|
"./loaders/platform-server-exports-loader": {
|
|
42
42
|
"types": "./dist/lib/plugins/loaders/platform-server-exports.loader.d.ts",
|
|
43
43
|
"default": "./dist/lib/plugins/loaders/platform-server-exports.loader.js"
|
|
44
|
-
},
|
|
45
|
-
"./ssr": {
|
|
46
|
-
"types": "./dist/lib/ssr/server.d.ts",
|
|
47
|
-
"default": "./dist/lib/ssr/server.js"
|
|
48
44
|
}
|
|
49
45
|
},
|
|
50
46
|
"dependencies": {
|
|
@@ -55,7 +51,6 @@
|
|
|
55
51
|
"ansi-colors": "4.1.3",
|
|
56
52
|
"autoprefixer": "10.4.21",
|
|
57
53
|
"deepmerge": "^4.3.1",
|
|
58
|
-
"express": "4.21.1",
|
|
59
54
|
"css-loader": "^7.1.2",
|
|
60
55
|
"jsonc-parser": "^3.3.1",
|
|
61
56
|
"less-loader": "^12.2.0",
|
|
@@ -64,7 +59,7 @@
|
|
|
64
59
|
"open": "10.1.0",
|
|
65
60
|
"ora": "5.4.1",
|
|
66
61
|
"parse5-html-rewriting-stream": "7.0.0",
|
|
67
|
-
"piscina": "
|
|
62
|
+
"piscina": "5.0.0",
|
|
68
63
|
"postcss": "8.5.3",
|
|
69
64
|
"postcss-loader": "8.1.1",
|
|
70
65
|
"resolve-url-loader": "^5.0.0",
|
|
@@ -74,7 +69,7 @@
|
|
|
74
69
|
"tslib": "^2.3.0",
|
|
75
70
|
"webpack-merge": "^6.0.1",
|
|
76
71
|
"ws": "^8.18.0",
|
|
77
|
-
"@nx/angular-rspack-compiler": "21.0
|
|
72
|
+
"@nx/angular-rspack-compiler": "21.1.0"
|
|
78
73
|
},
|
|
79
74
|
"devDependencies": {
|
|
80
75
|
"@code-pushup/models": "^0.63.0",
|
|
@@ -83,10 +78,9 @@
|
|
|
83
78
|
"@ng-rspack/testing-setup": "0.0.1"
|
|
84
79
|
},
|
|
85
80
|
"peerDependencies": {
|
|
86
|
-
"@angular/
|
|
87
|
-
"@angular/
|
|
88
|
-
"@angular/
|
|
89
|
-
"@angular/platform-server": ">=19.0.0 <20.0.0",
|
|
81
|
+
"@angular/build": ">=19.0.0 <21.0.0",
|
|
82
|
+
"@angular/localize": ">=19.0.0 <21.0.0",
|
|
83
|
+
"@angular/platform-server": ">=19.0.0 <21.0.0",
|
|
90
84
|
"zone.js": ">=0.14.0 <0.16.0",
|
|
91
85
|
"@angular/ssr": ">=19.0.0 <20.0.0",
|
|
92
86
|
"@rspack/core": ">=1.3.5 <2.0.0",
|
package/dist/lib/ssr/server.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import express from 'express';
|
|
2
|
-
interface RspackAngularServer {
|
|
3
|
-
app: express.Express;
|
|
4
|
-
listen: (port?: number) => void;
|
|
5
|
-
}
|
|
6
|
-
export interface RspackAngularServerOptions {
|
|
7
|
-
serverDistFolder?: string;
|
|
8
|
-
browserDistFolder?: string;
|
|
9
|
-
indexHtml?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function createServer(bootstrap: any, opts?: RspackAngularServerOptions): RspackAngularServer;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/lib/ssr/server.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,UAAU,mBAAmB;IAC3B,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC;IACrB,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAC1B,SAAS,EAAE,GAAG,EACd,IAAI,CAAC,EAAE,0BAA0B,GAChC,mBAAmB,CAmDrB"}
|
package/dist/lib/ssr/server.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createServer = createServer;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const common_1 = require("@angular/common");
|
|
6
|
-
const node_1 = require("@angular/ssr/node");
|
|
7
|
-
const express_1 = tslib_1.__importDefault(require("express"));
|
|
8
|
-
const node_path_1 = require("node:path");
|
|
9
|
-
function createServer(bootstrap, opts) {
|
|
10
|
-
const serverDistFolder = opts?.serverDistFolder ?? (0, node_path_1.dirname)(__filename);
|
|
11
|
-
const browserDistFolder = opts?.browserDistFolder ?? (0, node_path_1.resolve)(serverDistFolder, '../browser');
|
|
12
|
-
const indexHtml = opts?.indexHtml ?? (0, node_path_1.join)(browserDistFolder, 'index.html');
|
|
13
|
-
const app = (0, express_1.default)();
|
|
14
|
-
const commonEngine = new node_1.CommonEngine();
|
|
15
|
-
app.get('**', express_1.default.static(browserDistFolder, {
|
|
16
|
-
maxAge: '1y',
|
|
17
|
-
index: false,
|
|
18
|
-
}));
|
|
19
|
-
/**
|
|
20
|
-
* Handle all other requests by rendering the Angular application.
|
|
21
|
-
*/
|
|
22
|
-
app.get('**', async (req, res, next) => {
|
|
23
|
-
const { protocol, originalUrl, baseUrl, headers } = req;
|
|
24
|
-
commonEngine
|
|
25
|
-
.render({
|
|
26
|
-
bootstrap,
|
|
27
|
-
documentFilePath: indexHtml,
|
|
28
|
-
url: `${protocol}://${headers.host}${originalUrl}`,
|
|
29
|
-
publicPath: browserDistFolder,
|
|
30
|
-
providers: [{ provide: common_1.APP_BASE_HREF, useValue: baseUrl }],
|
|
31
|
-
})
|
|
32
|
-
.then((html) => {
|
|
33
|
-
res.send(html);
|
|
34
|
-
})
|
|
35
|
-
.catch((err) => next(err));
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
app,
|
|
39
|
-
listen: (port = process.env['PORT']
|
|
40
|
-
? Number.parseInt(process.env['PORT'], 10)
|
|
41
|
-
: 4000) => {
|
|
42
|
-
app.listen(port, () => {
|
|
43
|
-
console.log(`Node Express server listening on http://localhost:${port}`);
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
}
|