Skip to content

Commit be843c4

Browse files
authored
Use typescript for webpack config (#32507)
* Move declaration.d.ts to @types Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Load customisations.json without `require` Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Remove webpack rule from when we were consuming shared-components ts vs js Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Avoid hardcoding paths to modules in webpack config Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Convert webpack config to typescript Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Stub js webpack/postcss plugins Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Patch broken rollup types until getsentry/sentry-javascript-bundler-plugins#870 is released Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Install @types/postcss-import Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix fdir relying on @types/picomatch Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update pnpm-lock.yaml Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent d0b53a6 commit be843c4

12 files changed

Lines changed: 232 additions & 114 deletions

@types/postcss-easings.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
Copyright 2026 Element Creations Ltd.
3+
4+
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+
Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
declare module "postcss-easings" {
9+
export default function (): void;
10+
}

@types/postcss-hexrgba.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
Copyright 2026 Element Creations Ltd.
3+
4+
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+
Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
declare module "postcss-hexrgba" {
9+
export default function (): void;
10+
}

@types/postcss-mixins.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
Copyright 2026 Element Creations Ltd.
3+
4+
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+
Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
declare module "postcss-mixins" {
9+
export default function (): void;
10+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
Copyright 2026 Element Creations Ltd.
3+
4+
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+
Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
declare module "webpack-version-file-plugin" {
9+
interface Opts {
10+
outputFile: string;
11+
template?: string;
12+
templateString?: string;
13+
extras?: Record<string, string>;
14+
}
15+
16+
export default class VersionFilePlugin {
17+
public constructor(opts: Opts);
18+
}
19+
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@
181181
"@types/modernizr": "^3.5.3",
182182
"@types/node": "22",
183183
"@types/pako": "^2.0.0",
184+
"@types/postcss-import": "^14.0.3",
184185
"@types/qrcode": "^1.3.5",
185186
"@types/react": "catalog:",
186187
"@types/react-beautiful-dnd": "^13.0.0",
@@ -284,7 +285,8 @@
284285
"@types/mdx": "patches/@types__mdx.patch",
285286
"await-lock": "patches/await-lock.patch",
286287
"jest-fixed-jsdom": "patches/jest-fixed-jsdom.patch",
287-
"jsdom": "patches/jsdom.patch"
288+
"jsdom": "patches/jsdom.patch",
289+
"rollup": "patches/rollup.patch"
288290
},
289291
"peerDependencyRules": {
290292
"allowedVersions": {

patches/rollup.patch

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/dist/rollup.d.ts b/dist/rollup.d.ts
2+
index 799df4a69cc0d7ac26c3357c8c2bd3f68365d609..67a6e48c65324f62a6724732f90ad0a776fa7ef5 100644
3+
--- a/dist/rollup.d.ts
4+
+++ b/dist/rollup.d.ts
5+
@@ -160,6 +160,9 @@ export interface MinimalPluginContext {
6+
warn: LoggingFunction;
7+
}
8+
9+
+// Temporary until https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/870 is released
10+
+export type AcornNode = unknown;
11+
+
12+
export interface EmittedAsset {
13+
fileName?: string | undefined;
14+
name?: string | undefined;

pnpm-lock.yaml

Lines changed: 53 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ catalog:
2222
"@vector-im/compound-web": 8.3.6
2323
# i18n
2424
matrix-web-i18n: 3.6.0
25+
packageExtensions:
26+
fdir:
27+
dependencies:
28+
# Fix missing type dependency
29+
"@types/picomatch": 4.0.2

project.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"outputs": ["{projectRoot}/res/css/_components.pcss"]
3131
},
3232
"build": {
33-
"command": "webpack-cli --progress --mode production",
33+
"command": "webpack-cli --disable-interpret --progress --mode production",
3434
"outputs": ["{projectRoot}/webapp"]
3535
},
3636
"start:i18n": {
@@ -39,7 +39,7 @@
3939
"continuous": true
4040
},
4141
"start": {
42-
"command": "webpack-dev-server --output-path webapp --output-filename=bundles/_dev_/[name].js --output-chunk-filename=bundles/_dev_/[name].js --mode development",
42+
"command": "webpack-dev-server --disable-interpret --output-path webapp --output-filename=bundles/_dev_/[name].js --output-chunk-filename=bundles/_dev_/[name].js --mode development",
4343
"dependsOn": ["prebuild:*", "start:i18n", "^start"],
4444
"continuous": true
4545
},

0 commit comments

Comments
 (0)