Skip to content

Commit 4d2d433

Browse files
Add files via upload
1 parent 3907189 commit 4d2d433

File tree

3 files changed

+121
-36
lines changed

3 files changed

+121
-36
lines changed

package-lock.json

Lines changed: 94 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"install": "^0.13.0",
5757
"interactjs": "^1.10.26",
5858
"isect": "^3.0.2",
59+
"jdenticon": "^3.3.0",
5960
"jsts": "^2.11.3",
6061
"jszip": "^3.10.1",
6162
"loglevel": "^1.9.1",
@@ -76,7 +77,6 @@
7677
"vite": "^6.2.6"
7778
},
7879
"engines": {
79-
"node": ">=20 <25"
80-
}
81-
80+
"node": ">=20 <25"
81+
}
8282
}

webpack.config.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,27 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
44
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
55

66
module.exports = {
7-
entry: ['./src/main.ts', './src/js/index.js'], // removed './src/bundle.js'
7+
// Ensure index.js (CSS + UI wiring) runs before main.ts to avoid FOUC/layout races
8+
entry: ['./src/js/index.js', './src/main.ts'],
89
mode: 'development',
910

1011
// Enable proper source maps for debugging (creates bundle.js.map)
1112
devtool: 'source-map',
1213

1314
output: {
14-
filename: 'bundle.js', // use the classic name for clarity
15+
filename: 'bundle.js', // classic name for clarity
1516
path: path.resolve(__dirname, 'dist'),
1617
clean: true,
18+
// important for correct chunk/asset resolution in dev and MF
19+
publicPath: '/',
1720
},
1821

1922
resolve: {
20-
extensions: ['.ts', '.js', '.json'],
23+
extensions: ['.ts', '.tsx', '.js', '.json'],
2124
alias: {
22-
// Optional: add alias for easier imports
25+
// Optional aliases to simplify imports and guarantee resolution
26+
'@cityManagers': path.resolve(__dirname, 'src/js/cityManagers'),
27+
'lodash$': path.resolve(__dirname, 'src/js/lodash.js'),
2328
},
2429
},
2530

@@ -38,6 +43,11 @@ module.exports = {
3843
test: /\.css$/i,
3944
use: ['style-loader', 'css-loader'],
4045
},
46+
// add loaders for images/fonts if your app uses them in CSS/HTML
47+
{
48+
test: /\.(png|jpg|jpeg|gif|svg|woff2?|eot|ttf)$/,
49+
type: 'asset/resource',
50+
},
4151
],
4252
},
4353

@@ -47,6 +57,7 @@ module.exports = {
4757
title: 'CityGenerator',
4858
template: './src/html/index.html',
4959
filename: 'index.html',
60+
inject: 'body', // ensure scripts are injected at the end of body
5061
}),
5162
new ModuleFederationPlugin({
5263
name: 'fabcity',
@@ -62,6 +73,8 @@ module.exports = {
6273
'digibyte-js': { singleton: true },
6374
'browserify': { singleton: true },
6475
'flatbush': { singleton: true },
76+
// share jdenticon only if you actually use Module Federation across remotes and hosts.
77+
'jdenticon': { singleton: true, eager: false, requiredVersion: false },
6578
},
6679
}),
6780
],
@@ -78,4 +91,11 @@ module.exports = {
7891
index: '/index.html',
7992
},
8093
},
94+
95+
// keep splitChunks conservative: only dynamic-imported modules are split
96+
optimization: {
97+
splitChunks: {
98+
chunks: 'async'
99+
}
100+
}
81101
};

0 commit comments

Comments
 (0)