-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrspack.config.js
More file actions
69 lines (68 loc) · 2.74 KB
/
Copy pathrspack.config.js
File metadata and controls
69 lines (68 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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) || ''),
},
},
},
}),
module: {
rules: [
{
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'],
},
]
: []),
],
},
}));