diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-05-28 15:20:46 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-05-28 15:20:46 +0200 |
| commit | f9a9fa15d6d61eb9730183193ce8af29bdfc17e7 (patch) | |
| tree | c3b96a36623e52f22d281b518d7136795cf82b8a /cockpit/webpack.config.js | |
| download | bycs-sol-f9a9fa15d6d61eb9730183193ce8af29bdfc17e7.tar.gz bycs-sol-f9a9fa15d6d61eb9730183193ce8af29bdfc17e7.zip | |
cockpit: initial commit
Diffstat (limited to 'cockpit/webpack.config.js')
| -rw-r--r-- | cockpit/webpack.config.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/cockpit/webpack.config.js b/cockpit/webpack.config.js new file mode 100644 index 0000000..ec3e2fe --- /dev/null +++ b/cockpit/webpack.config.js @@ -0,0 +1,36 @@ +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: './js/cockpit.js', + output: { + path: path.resolve(__dirname, 'dist'), + }, + 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; +}; |
