diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-08-03 14:31:25 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-08-03 14:31:25 +0200 |
| commit | 6839831af54cd9302119bcc3bffafe10475958d4 (patch) | |
| tree | 12a1c1fbd864e9579cb9c3a09d4bf4686a280b73 /webpack.config.js | |
| parent | fccb70cbd876785f6833dfe6efc10ec9e445556d (diff) | |
| download | bycs-sol-6839831af54cd9302119bcc3bffafe10475958d4.tar.gz bycs-sol-6839831af54cd9302119bcc3bffafe10475958d4.zip | |
refactor project structure
* merge sites into single project root
* fix name of mass-graduation site
* enable typescript support
Diffstat (limited to 'webpack.config.js')
| -rw-r--r-- | webpack.config.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..081a2a1 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,48 @@ +const webpack = require('webpack'); +const path = require('path'); + +const isProduction = process.env.NODE_ENV === 'production'; +const isMock = process.env.NODE_ENV === 'mock'; + +const config = { + entry: { + 'cockpit': './src/cockpit.js', + 'mass-graduation': './src/mass-graduation.js', + 'admin-tools': './src/admin-tools.js', + }, + output: { + path: path.resolve(__dirname, 'dist'), + }, + module: { + rules: [ + { + test: /\.png/, + type: 'asset/inline', + }, + ], + }, + plugins: [ + new webpack.NormalModuleReplacementPlugin( + /-ENV.js/, + (resource) => { + resource.request = resource.request.replace( + /-ENV/, + `-${isMock ? "mock" : "prod"}`, + ); + + if (resource.createData) { + resource.createData.request = resource.request; + } + } + ) + ], +}; + +module.exports = () => { + if (isProduction) { + config.mode = 'production'; + } else { + config.mode = 'development'; + } + return config; +}; |
