1. Module bundling added to reduce server calls as each file was taking ~440 ms to load on public server.\n2. JavaScript lib files refactored with OOP for use with module bundling.

This commit is contained in:
2024-09-10 19:43:02 +01:00
parent da880da90f
commit cef903ff39
7678 changed files with 778712 additions and 1254 deletions

41
webpack.config.js Normal file
View File

@@ -0,0 +1,41 @@
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: {
main: [
path.resolve(__dirname, 'static/js/app.js'),
path.resolve(__dirname, 'static/css/main.css')
]
},
output: {
filename: 'js/[name].bundle.js',
path: path.resolve(__dirname, 'static/dist'),
},
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
],
},
{
test: /\.js$/,
exclude: path.resolve(__dirname, 'templates'), // Exclude templates folder
use: {
loader: 'babel-loader',
},
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: 'css/[name].css',
}),
],
resolve: {
extensions: ['.js', '.json', '.wasm']
}
};