mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 15:14:52 +09:00
Resolve browser polyfills from web_ui
Lib and plugins import Node.js modules such as events and buffer, which the build swaps for browser packages. Vite resolves an aliased import from the importing package, and pnpm only lets a package see its own dependencies, so the polyfills had to be dependencies of lib. Resolve them from web_ui with a small resolver plugin instead, also used by the dependency optimizer. Hosts no longer install the browser packages, and plugins get the same polyfills webpack gave them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e94abe51c9
commit
a4db2dc460
5 files changed
+40
-27
No files matched your search
@@ -54,7 +54,6 @@ These are left as imports in the plugin bundle and resolved by the browser, ther
|
||||
Everything else is bundled into the plugin, including `@ant-design/icons`.
|
||||
Import `react-dom/client` and `react/jsx-runtime` by those names, other subpaths of the shared packages are bundled as a separate copy.
|
||||
|
||||
Vite does not provide Node.js modules to plugin code.
|
||||
If your web code imports `events`, `path` or similar, add the browser package for it (`events`, `path-browserify`) to your dependencies.
|
||||
Imports of `assert`, `buffer`, `events`, `os`, `path`, `process`, `stream`, `util` and `zlib` resolve to the same browser packages as before, provided by `@clusterio/web_ui`.
|
||||
|
||||
The `container` property of `WebPluginContext` is now the plugin's ES module namespace, `await container.get("./web")` returns the module instead of a factory function.
|
||||
Reference in new issue
Block a user