build(docker/frontend): fix babel and webpack config for new node version

This commit is contained in:
Sarah Vaupel 2024-09-02 15:50:26 +02:00
parent 95e1f03d31
commit 0ecba9f829
6 changed files with 2728 additions and 992 deletions

View File

@ -1,17 +0,0 @@
{
"presets": [
["env", {
"useBuiltIns": "usage",
"targets": { "node": "current" }
}
]
],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }],
["@babel/plugin-proposal-private-methods", { "loose": true }],
["@babel/plugin-proposal-private-property-in-object", { "loose": true }],
["@babel/plugin-transform-modules-commonjs"],
["@babel/transform-runtime"]
]
}

26
babel.config.js Normal file
View File

@ -0,0 +1,26 @@
module.exports = (api) => {
api.cache(true);
const presets = [
["env", {
"useBuiltIns": "usage",
"targets": { "node": "current" },
}
]
];
const plugins = [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-syntax-dynamic-import"],
["@babel/plugin-transform-class-properties", { "loose": true }],
["@babel/plugin-transform-private-methods", { "loose": true }],
["@babel/plugin-transform-private-property-in-object", { "loose": true }],
["@babel/plugin-transform-modules-commonjs"],
["@babel/transform-runtime"],
];
return {
presets,
plugins,
};
}

View File

@ -17,7 +17,7 @@ ENV CHROME_BIN=chromium
RUN npm install -g n
RUN n 20.17.0
# debug only
# debug only, should display v20.17.0
RUN node --version
ARG PROJECT_DIR=/fradrive

3645
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,8 +13,10 @@
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.25.1",
"@babel/plugin-proposal-decorators": "^7.24.7",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-class-properties": "^7.25.4",
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
"@babel/plugin-transform-private-methods": "^7.18.6",
"@babel/plugin-transform-private-property-in-object": "^7.24.7",
"@babel/plugin-transform-runtime": "^7.25.4",
"@babel/preset-env": "^7.25.4",
@ -22,7 +24,7 @@
"autoprefixer": "^10.4.20",
"axios": "^1.7.5",
"babel-loader": "^9.1.3",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-preset-env": "^1.7.0",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel <sarah.vaupel@uniworx.de>, Gregor Kleen <gregor.kleen@ifi.lmu.de>, Sarah Vaupel <sarah.vaupel@ifi.lmu.de>, Sarah Vaupel <vaupel.sarah@campus.lmu.de>, David Mosbach <david.mosbach@uniworx.de>
// SPDX-FileCopyrightText: 2022-2024 Sarah Vaupel <sarah.vaupel@uniworx.de>, David Mosbach <david.mosbach@uniworx.de>, Gregor Kleen <gregor.kleen@ifi.lmu.de>, Sarah Vaupel <sarah.vaupel@ifi.lmu.de>, Sarah Vaupel <vaupel.sarah@campus.lmu.de>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
@ -27,29 +27,27 @@ const webpackVersion = require('webpack/package.json').version.split('.').slice(
const packageVersion = require('./package.json').version;
async function webpackConfig() {
const wellKnownCacheDir = path.resolve(__dirname, '.well-known-cache');
const wellKnownCacheDir = path.resolve(__dirname, '.cache/well-known');
const assetsDirectory = path.resolve(__dirname, 'assets');
let faviconApiVersion = undefined;
// FIXME: fetching current favicon api version broken right now (needs adaptation to axios)
// if (!fs.existsSync(wellKnownCacheDir)) {
// try {
// const faviconApiChangelog = await axios.get('https://realfavicongenerator.net/api/versions');
// faviconApiVersion = faviconApiChangelog.filter(vObj => vObj.relevance.automated_update).slice(-1)[0].version;
// } catch(e) {
// console.error(e);
// }
// }
if (!fs.existsSync(wellKnownCacheDir)) {
try {
const faviconApiChangelog = await axios.get('https://realfavicongenerator.net/api/versions');
faviconApiVersion = faviconApiChangelog.data.filter(vObj => vObj.relevance.automated_update).slice(-1)[0].version;
} catch(e) {
console.error(e);
}
}
return {
module: {
rules: [
{
loader: 'babel-loader',
options: {
plugins: ['syntax-dynamic-import'],
// plugins: ['syntax-dynamic-import'],
//
presets: [
[
'@babel/preset-env',