Files
wekan/rspack.config.js
T
Lauri Ojansivu 79ac301675 Email bounces with Amazon SES, Problems -> Email, and runtime tests for sending and receiving.
Email that comes back is handled in WeKan instead of landing in the
administrator's own inbox. Admin Panel -> E-mail -> Bounces: hard bounces
(a mistyped invited address), soft bounces, automatic replies and spam
complaints, each with actions done after a count - list it, stop emailing
the address, tell who invited it, delete the invitation, ignore - as
listmonk and Discourse do it, and the list of addresses that bounced, which
an admin clears to email them again. Amazon SES Bounce and Complaint
notifications and mail SES receives arrive through SNS at
/api/inbound-email/ses, signature-checked against Amazon's certificate and
accepted only from the topics the Admin Panel lists. Delivery status
notifications and out-of-office replies arriving by IMAP, a provider
webhook or a Sandstorm grain are bounces too, never cards.

Admin Panel -> Problems -> Email shows what went wrong sending or
receiving: a send the mail server refused or could not reach, an IMAP
mailbox that cannot be read (never with its password), an unreadable
email, an email for a board that no longer takes email. Attempts stay in
Problems -> Security. The inbound email endpoints no longer need the whole
REST API turned on.

Runtime tests run WeKan's own transports against local SMTP and IMAP
servers over TCP, a real Sandstorm Maildir, the webhook over HTTP and
signed SNS messages; UI tests drive the Email and Chat views, the
email-to-card settings and the Bounces page. They found and this fixes:
every whole-message parse failed in the server bundle (nodemailer's
addressparser resolved to its ESM build), the Chat view's drag and drop
never started (dragscroll took the mouse) and dropped a card into the
target's previous list, and the Chat panes did not follow a change to a
right-to-left language.

Thanks to xet7 !

Fixes #794,
Fixes #3948.
2026-10-13 18:27:25 +03:00

93 lines
3.8 KiB
JavaScript

const { defineConfig } = require('@meteorjs/rspack');
const path = require('path');
module.exports = defineConfig(Meteor => ({
...(Meteor.isClient && {
experiments: {
css: false,
},
}),
// A development watcher lives for hours and rebuilds the same large Blaze graph
// repeatedly. Rspack 1.x's experimental persistent cache retains JavaScript-side
// serialization state across those rebuilds; on WeKan this can eventually fill a
// 16 GB V8 heap. Production builds are short-lived and still benefit from the
// persistent cache, so disable it only for `meteor run`.
...(Meteor.isRun && {
cache: false,
experiments: {
...(Meteor.isClient && { css: false }),
cache: false,
},
}),
// Dev server only (`meteor run`; a production build has no devServer and no overlay
// at all). webpack-dev-server's overlay catches every window 'error' event and covers
// the whole app with a modal "Uncaught runtime errors:" panel. Browsers sanitise an
// error thrown by a CROSS-ORIGIN script to the content-free message "Script error."
// with no stack and no error object, and iOS Safari raises those from its own
// machinery and from content blockers / extensions — e.g. when the Share sheet is
// opened to "Add to Home Screen". WeKan's own bundle is same-origin (no CDN_URL), so
// a real WeKan error always arrives with its actual message and stack; "Script error."
// never comes from our code and there is nothing to act on. Ignore exactly that
// message so the overlay stops hiding the app on iPad, and keep every other runtime
// error — and all compile errors — showing as before.
//
// runtimeErrors accepts (error) => boolean. webpack-dev-server serialises it with
// toString() and rebuilds it client-side with new Function(), so it must stay
// self-contained: no closure variables, no imports (tests/devOverlayRuntimeErrors.test.cjs
// round-trips it exactly the way the dev server does).
...(Meteor.isClient && Meteor.isRun && {
devServer: {
client: {
overlay: {
errors: true,
warnings: false,
runtimeErrors: error =>
!/^script error\.?$/i.test((error && error.message) || ''),
},
},
},
}),
// mailparser (email to card, #794) does `require('nodemailer/lib/addressparser')`.
// nodemailer 10 publishes that subpath as ESM for `import` and CommonJS for
// `require`, and the server bundle resolved the require to the ESM build, so
// the function arrived as `{ default }` and every parsed email failed with
// "addressparser is not a function". Point the server at the CommonJS build,
// which exports the function itself. tests/emailToCard.test.cjs pins this.
...(Meteor.isServer && {
resolve: {
alias: {
'nodemailer/lib/addressparser$': path.resolve(__dirname, 'node_modules/nodemailer/dist/cjs/addressparser/index.js'),
},
},
}),
module: {
rules: [
...(Meteor.isServer
? [{
test: /\.i18n\.json$/,
include: path.resolve(__dirname, 'imports/i18n/data'),
// English is the synchronous fallback in tap.js on both platforms.
exclude: /[/\\]en\.i18n\.json$/,
type: 'javascript/auto',
use: [path.resolve(__dirname, 'npm-packages/meteor-i18n-server-loader')],
}]
: []),
{
test: /\.jade$/,
use: [path.resolve(__dirname, 'npm-packages/meteor-jade-loader')],
},
...(Meteor.isClient
? [
{
test: /\.css$/i,
// Meteor's base config assigns css/auto. Our loaders emit JS;
// override the type so their style injection runs in Rspack 2.
type: 'javascript/auto',
use: ['style-loader', 'css-loader'],
},
]
: []),
],
},
}));