Improve netcode and simplify (#4)
- Simplify the logic wherever possible to remove overengineering and simplify the netcode - Actually improve the netcode - The new lines are mainly the package locks and tests Reviewed-on: https://home.schmelczer.dev/git/andras/decla-red/pulls/4
This commit is contained in:
parent
5d854440ec
commit
93a7fe01ab
1 changed files with 15073 additions and 4754 deletions
|
|
@ -5,7 +5,6 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|||
const TerserJSPlugin = require('terser-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const HTMLInlineCSSWebpackPlugin = require('html-inline-css-webpack-plugin').default;
|
||||
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
const Sass = require('sass');
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
|
|
@ -23,35 +22,25 @@ module.exports = (env, argv) => {
|
|||
host: '0.0.0.0',
|
||||
allowedHosts: 'all',
|
||||
},
|
||||
// webpack-dev-server 5 no longer accepts `watchOptions` under `devServer`;
|
||||
// polling is configured on the compiler instead (needed for some FS mounts).
|
||||
watchOptions: {
|
||||
poll: true,
|
||||
},
|
||||
plugins: [
|
||||
new CleanWebpackPlugin(),
|
||||
new MiniCssExtractPlugin(),
|
||||
//new BundleAnalyzerPlugin(),
|
||||
new HtmlWebpackPlugin({
|
||||
template: './src/index.html',
|
||||
}),
|
||||
// The SVG UI icons used to be inlined into the HTML by the (abandoned,
|
||||
// webpack-4-only) html-webpack-inline-svg-plugin. They are now emitted as
|
||||
// static files and referenced via `static/<name>.svg` from index.html.
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [{ from: 'static/*.svg', to: 'static/[name][ext]' }],
|
||||
}),
|
||||
// Inline the extracted CSS into the HTML for production builds (replaces
|
||||
// the abandoned html-webpack-inline-source-plugin). In development the CSS
|
||||
// stays a separate, linked file for faster rebuilds.
|
||||
...(isProduction ? [new HTMLInlineCSSWebpackPlugin()] : []),
|
||||
],
|
||||
optimization: {
|
||||
minimizer: [
|
||||
new TerserJSPlugin({
|
||||
exclude: /node_modules/,
|
||||
// The custom serialization protocol keys on class names, so they must
|
||||
// survive minification (see shared/src/serialization).
|
||||
// The serialization protocol keys on class names.
|
||||
terserOptions: {
|
||||
keep_classnames: true,
|
||||
},
|
||||
|
|
@ -86,23 +75,11 @@ module.exports = (env, argv) => {
|
|||
],
|
||||
},
|
||||
{
|
||||
// SVGs referenced from CSS (`mask-image`/`background-image`) and JS
|
||||
// must be inlined as real `data:` URIs. svg-url-loader emits a CJS
|
||||
// module (`module.exports = "data:..."`) which webpack 5 + css-loader 7
|
||||
// write out verbatim as a `.svg` asset file, so the browser fetches JS
|
||||
// instead of an image and the mask/background silently fails. webpack 5's
|
||||
// built-in `asset/inline` produces a proper data URI instead.
|
||||
// (HTML <img> icons are unaffected: they are copied by CopyWebpackPlugin
|
||||
// and referenced by literal `static/*.svg` paths, not through this rule.)
|
||||
test: /\.svg$/,
|
||||
type: 'asset/inline',
|
||||
},
|
||||
{
|
||||
// Use oneOf so each asset matches exactly one rule (og-image.png would
|
||||
// otherwise match both the generic png rule and its own rule).
|
||||
// The directory is encoded in `name` (not `outputPath`) and has no
|
||||
// leading slash: with the default `publicPath: 'auto'` a leading slash
|
||||
// produces a doubled slash in the emitted URL (e.g. `//static/x.mp3`).
|
||||
// No leading slash in `name`: with publicPath 'auto' it doubles the slash.
|
||||
oneOf: [
|
||||
{
|
||||
test: /og-image\.png$/,
|
||||
|
|
@ -136,6 +113,8 @@ module.exports = (env, argv) => {
|
|||
],
|
||||
},
|
||||
resolve: {
|
||||
// Shared physics and rendering must use the same matrix array type as index.ts.
|
||||
alias: { 'gl-matrix': path.resolve(__dirname, 'node_modules/gl-matrix') },
|
||||
extensions: ['.ts', '.js', '.json'],
|
||||
},
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue