Skip to content
This repository was archived by the owner on Sep 6, 2025. It is now read-only.

Commit 94e87de

Browse files
feat(angular-rspack): Add "zoneless" option to enable Angular's provideZonelessChangeDetection() usage (#115)
* feat(angular-rspack): add "zoneless" option to disable zone.js initialization within PrerenderPlugin * test: add e2e fixture for zoneless CSR with CSS spec * test: add e2e fixture for zoneless CSR (i18n) with CSS spec * test: add e2e fixture for zoneless SSG with CSS spec * test: add e2e fixture for zoneless SSR with CSS spec * fix: update import format * fix: replace zoneless property, inferring zone.js polyfill presence instead * fix: update pnpm-lock.yaml --------- Co-authored-by: Jakub Chlebowicz <[email protected]>
1 parent feb764c commit 94e87de

File tree

98 files changed

+4341
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+4341
-15
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const baseConfig = require('../../../eslint.config');
2+
3+
module.exports = [
4+
...baseConfig,
5+
{
6+
files: ['**/*.ts'],
7+
languageOptions: {
8+
parserOptions: {
9+
projectService: true,
10+
tsconfigRootDir: __dirname,
11+
},
12+
},
13+
},
14+
{
15+
files: ['**/*'],
16+
rules: {},
17+
},
18+
];
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "rspack-zoneless-csr-css",
3+
"version": "0.0.1",
4+
"private": true,
5+
"scripts": {},
6+
"dependencies": {
7+
"@nx/angular-rspack": "workspace:*"
8+
},
9+
"nx": {
10+
"targets": {
11+
"serve-api": {
12+
"continuous": true,
13+
"command": "node ./src/api.mjs",
14+
"options": {
15+
"cwd": "e2e/fixtures/rspack-zoneless-csr-css"
16+
}
17+
},
18+
"serve": {
19+
"dependsOn": [
20+
"serve-api"
21+
]
22+
}
23+
}
24+
}
25+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"/api": {
3+
"target": "http://localhost:3000",
4+
"secure": false,
5+
"changeOrigin": true
6+
}
7+
}
14.7 KB
Binary file not shown.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
module.exports = () => {
2+
if (global.NX_GRAPH_CREATION === undefined) {
3+
const { createConfig } = require('@nx/angular-rspack');
4+
return createConfig(
5+
{
6+
options: {
7+
root: __dirname,
8+
index: './src/index.html',
9+
assets: [
10+
{
11+
input: '../shared/assets/src/assets',
12+
glob: '**/*',
13+
output: 'assets',
14+
},
15+
{ glob: '**/*', input: 'public' },
16+
],
17+
styles: [
18+
{
19+
input: '../shared/styles/src/index.scss',
20+
bundleName: 'shared-styles',
21+
},
22+
'./src/styles.css',
23+
],
24+
scripts: [
25+
'./scripts/script1.js',
26+
{ input: './scripts/script2.js', bundleName: 'scripts' },
27+
{
28+
input: './scripts/internal-shared-script.js',
29+
bundleName: 'shared-scripts',
30+
},
31+
{
32+
input: '../shared/scripts/shared-script.js',
33+
bundleName: 'shared-scripts',
34+
},
35+
{
36+
input: './scripts/non-initial-script.js',
37+
bundleName: 'non-initial-script',
38+
inject: false,
39+
},
40+
],
41+
polyfills: [],
42+
browser: './src/main.ts',
43+
outputPath: {
44+
base: './dist',
45+
browser: './static',
46+
},
47+
sourceMap: {
48+
scripts: true,
49+
styles: true,
50+
},
51+
tsConfig: './tsconfig.app.json',
52+
skipTypeChecking: false,
53+
devServer: {
54+
host: '127.0.0.1',
55+
port: 8080,
56+
proxyConfig: './proxy.conf.json',
57+
hmr: true,
58+
liveReload: false,
59+
open: false, // Set to true when testing open option
60+
},
61+
define: {
62+
nxAngularRspack: '"20.6.2"',
63+
},
64+
baseHref: '/foo',
65+
subresourceIntegrity: true,
66+
crossOrigin: 'anonymous',
67+
watch: false, // Set to true when testing watch mode
68+
},
69+
},
70+
{
71+
development: {
72+
options: {
73+
extractLicenses: false,
74+
optimization: false,
75+
outputHashing: 'none',
76+
namedChunks: true,
77+
vendorChunk: true,
78+
},
79+
},
80+
production: {
81+
options: {
82+
budgets: [
83+
{
84+
type: 'initial',
85+
maximumWarning: '500kB',
86+
maximumError: '1MB',
87+
},
88+
{
89+
type: 'anyComponentStyle',
90+
maximumWarning: '4kB',
91+
maximumError: '8kB',
92+
},
93+
],
94+
outputHashing: 'all',
95+
},
96+
},
97+
}
98+
);
99+
}
100+
return {};
101+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('internal-shared-script');
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('non-initial-script');
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('script1');
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('script2');
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import http from 'node:http';
2+
3+
const server = http.createServer((req, res) => {
4+
const name = req.url?.split('/api/')[1] || 'stranger';
5+
6+
res.writeHead(200, {
7+
'Content-Type': 'application/json',
8+
'Access-Control-Allow-Origin': '*',
9+
});
10+
res.end(JSON.stringify({ message: `Hello ${name}!` }));
11+
});
12+
13+
server.listen(3000, () => {
14+
console.log('Server running at http://localhost:3000');
15+
});

0 commit comments

Comments
 (0)