diff --git a/.babelrc b/.babelrc index d2c3f85c5..175151195 100644 --- a/.babelrc +++ b/.babelrc @@ -4,10 +4,11 @@ "useBuiltIns": "usage", "targets": { "node": "current" } } - ] + ], + ["@babel/preset-typescript"] ], "plugins": [ - ["@babel/plugin-proposal-decorators", { "legacy": true }], + ["@babel/plugin-proposal-decorators", { "legacy": true, "version": "2023-11" }], ["@babel/plugin-proposal-class-properties", { "loose": true }], ["@babel/plugin-proposal-private-methods", { "loose": true }], ["@babel/plugin-proposal-private-property-in-object", { "loose": true }], diff --git a/.babelrc.license b/.babelrc.license index 3e1520e17..59a35451b 100644 --- a/.babelrc.license +++ b/.babelrc.license @@ -1,3 +1,3 @@ -SPDX-FileCopyrightText: 2022 Felix Hamann ,Sarah Vaupel ,Sarah Vaupel +SPDX-FileCopyrightText: 2022-2024 Felix Hamann ,Sarah Vaupel ,Sarah Vaupel ,David Mosbach SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..5e4b10e48 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "outDir": "./frontend/src/js", + "module": "es6", + "target": "es5", + "allowJs": true, + "moduleResolution": "node" + } +} diff --git a/tsconfig.json.license b/tsconfig.json.license new file mode 100644 index 000000000..304ca3389 --- /dev/null +++ b/tsconfig.json.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2024 David Mosbach + +SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/webpack.config.js b/webpack.config.js index 32927f0db..3abba369c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 Gregor Kleen ,Sarah Vaupel ,Sarah Vaupel +// SPDX-FileCopyrightText: 2022-2024 Gregor Kleen ,Sarah Vaupel ,Sarah Vaupel ,David Mosbach // // SPDX-License-Identifier: AGPL-3.0-or-later @@ -112,7 +112,7 @@ async function webpackConfig() { entry: { main: [ path.resolve(__dirname, 'frontend/src', 'polyfill.js'), - path.resolve(__dirname, 'frontend/src', 'main.js') + path.resolve(__dirname, 'frontend/src', 'main.ts') ] }, @@ -266,6 +266,10 @@ async function webpackConfig() { })() ], + resolve: { + extensions: ['.js', '.ts', '.tsx'] + }, + output: { chunkFilename: '[chunkhash].js', filename: '[chunkhash].js',