mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Put all web assets including plugin assets under a shared static/ route in the web interface that's declared as immutable and cacheable for 1 year. This allows all JavaScript bundles to be loaded from disk instead of having to check with the web server each time and significantly speeds up the web interface load time. It also fixes the public path issue when using the --dev-plugin option behind a proxy. To prevent collisions and stale data all assets now include a hash in the filename. This means the entrypoint is now dynamic and specified in a manifest.json file created from the web build. For plugins this means the filename attribute needs to be removed from webpack.config.js.
29 lines
700 B
JavaScript
29 lines
700 B
JavaScript
"use strict";
|
|
const path = require("path");
|
|
const webpack = require("webpack");
|
|
const { merge } = require("webpack-merge");
|
|
|
|
const common = require("@clusterio/web_ui/webpack.common");
|
|
|
|
module.exports = (env = {}) => merge(common(env), {
|
|
context: __dirname,
|
|
entry: "./web/index.jsx",
|
|
output: {
|
|
path: path.resolve(__dirname, "dist", "web"),
|
|
},
|
|
plugins: [
|
|
new webpack.container.ModuleFederationPlugin({
|
|
name: "research_sync",
|
|
library: { type: "var", name: "plugin_research_sync" },
|
|
exposes: {
|
|
"./info": "./info.js",
|
|
"./package.json": "./package.json",
|
|
},
|
|
shared: {
|
|
"@clusterio/lib": { import: false },
|
|
"@clusterio/web_ui": { import: false },
|
|
},
|
|
}),
|
|
],
|
|
});
|