mirror of
https://github.com/wekan/wekan.git
synced 2026-11-05 01:20:07 -05:00
Fix #6511: stop the collectionHelpers shim aborting the client module chain.
imports/collectionHelpers.js (a side-effect shim that patches
Mongo.Collection.prototype) ended with `module.exports = {}`. It also
references the Meteor pseudo-global `Package` BARE, which the client
rspack build - ProvidePlugin rewrites into an injected ESM `import`,
marking this file an ES module. An ES module that assigns
`module.exports` throws, at evaluation time,
`Uncaught Error: ES Modules may not assign module.exports or exports.*,
Use ESM export syntax, instead`. Because this shim is the FIRST import in
client/main.js, that throw ABORTED the whole client module chain: app
templates (swimlane, notifications, headerUserBar, ...) never registered,
so Blaze threw "No such template: swimlane" and the board stayed on the
maintenance spinner, the top user/settings bar was missing, and the login
form did not render - reproduced on Docker, Sandstorm and the official
boards.wekan.team (root domain), i.e. a global build bug, not infra. The
regression came from converting this shim to pure require()/module.exports.
Replace `module.exports = {}` with `export {}`: a clean ES module with no
CommonJS export, so no assignment throws, and it still works as a
side-effect import on the client and require() on the server. It exports
nothing, and no consumer reads its exports (both callers import/require it
only for its side effects).
Thanks to mueschel, jullbo, akshat-goel and xet7 !
Fixes #6511,
This commit is contained in:
1 parent
ce10cda9a9
commit
e62c775752
1 file changed
+12
-1
@@ -120,4 +120,15 @@ if (Mongo && Mongo.Collection && CollectionHooks && !Mongo.Collection._wekanHook
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {};
|
||||
// This is a side-effect-only shim (it patches Mongo.Collection.prototype); it exports
|
||||
// nothing. It MUST NOT assign `module.exports`: it references the Meteor pseudo-global
|
||||
// `Package` bare, which the client rspack build's ProvidePlugin rewrites into an injected
|
||||
// ESM `import`, marking this file an ES module — and an ES module assigning
|
||||
// `module.exports` throws `ES Modules may not assign module.exports or exports.*` at
|
||||
// evaluation time. Because this is the FIRST import in client/main.js, that throw aborted
|
||||
// the whole module chain, so app templates (swimlane, notifications, …) never registered
|
||||
// and Blaze reported "No such template" across the board (#6511, and the Sandstorm/Docker
|
||||
// v10.30–10.31 "board maintenance spinner" reports). An `export {}` marks it a clean ES
|
||||
// module with no CommonJS export, working under both the client (import) and server
|
||||
// (require) module systems.
|
||||
export {};
|
||||
Reference in new issue
Block a user