Hey Community,
Iβm comparing Sentry and Monti at the moment for Client Logging and I want to add sourcemapping for better error logs. It seems that the standart-minifier package of meteor does not provide sourcemapping and the docs of monti suggesting zodern-standart-minifier which got no updates now for a while. Which minifier do you use to provide sourcemapping?
1 Like
zodern
April 1, 2025, 3:12pm
2
zodern:standard-minifier-js is still maintained. There hasnβt been much need to update it.
6 Likes
Thanks for your response. Iβm testing the zodern-standart-minifier together now with hide-production-sourcemaps. So far my builds fail with:
/build/.meteor/packages/zodern_standard-minifier-js/.5.3.1.nka808eq0i++os+web.browser+web.browser.legacy+web.cordova/plugin.fastMinifier.os/npm/node_modules/meteor/fastMinifier/node_modules/meteor-package-install-swc/.swc/node_modules/@swc/core/index.js:110:29:
#16 202.8 x 'import.meta' cannot be used outside of module code.
Am I missing some config which is now needed?
A team member had also some attempts on this few months ago
opened 06:09PM - 14 Oct 24 UTC
I get a build error when upgrading to meteor 3.0.3 with minifier version 5.3.1. β¦ It did not happen with meteor 2.10.0 on the same version and there is also no error when using the [default minifier](https://packosphere.com/meteor/standard-minifier-js) and meteor 3.0.3.
<details>
<summary>Error message</summary>
```
While minifying app code:
/Users/kaifritsch/.meteor/packages/zodern_standard-minifier-js/.5.3.1.13xodu.yv0c3++os+web.browser+web.browser.legacy+web.cordova/plugin.fastMinifier.os/npm/node_modules/meteor/fastMinifier/node_modules/meteor-package-install-swc/.swc/node_modules/@swc/core/index.js:110:29:
Γ 'import.meta' cannot be used outside of module
code.
ββ[567:1]
567 β if (typeof WorkerGlobalScope < "u" && self instanceof
WorkerGlobalScope) {
568 β if (typeof o != "string")
569 β throw Error("corePath should be a string!");
570 β const y = new URL(o, import.meta.url).href, m = await
W(
Β· βββββββββββ
571 β y,
572 β "application/javascript"
573 β ), v = await W(
β°ββββ
Γ 'import.meta' cannot be used outside of module
code.
ββ[595:1]
595 β }
596 β if (typeof o != "string")
597 β throw Error("corePath should be a string!");
598 β const p = new URL(o, import.meta.url).href, c = await
W(
Β· βββββββββββ
599 β p,
600 β "application/javascript"
601 β ), l = await W(
β°ββββ
Γ 'import.meta' cannot be used outside of module
code.
ββ[632:1]
632 β }, p.readAsArrayBuffer(o);
633 β }), Re = async (o) => {
634 β let f = o;
635 β return typeof o > "u" ? new Uint8Array() : (typeof o ==
"string" ? /data:_data\/([a-zA-Z]*);base64,([^"]*)/.test(o) ? f =
atob(o.split(",")[1]).split("").map((s) => s.charCodeAt(0)) : f = await
(await fetch(new URL(o, import.meta.url).href)).arrayBuffer() : (o
instanceof File || o instanceof Blob) && (f = await Te(o)), new
Uint8Array(f));
Β·
βββββββββββ
636 β }, Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */
Object.defineProperty({
637 β __proto__: null,
638 β defaultOptions: Se,
β°ββββ
Caused by:
0: failed to parse input file
1: Syntax Error while minifying
dynamic/node_modules/react-audio-voice-recorder/dist/index-1c988149.js
at Compiler.minifySync
(/Users/kaifritsch/.meteor/packages/zodern_standard-minifier-js/.5.3.1.13xodu.yv0c3++os+web.browser+web.browser.legacy+web.cordova/plugin.fastMinifier.os/npm/node_modules/meteor/fastMinifier/node_modules/meteor-package-install-swc/.swc/node_modules/@swc/core/index.js:110:29)
at Object.minifySync
(/Users/kaifritsch/.meteor/packages/zodern_standard-minifier-js/.5.3.1.13xodu.yv0c3++os+web.browser+web.browser.legacy+web.cordova/plugin.fastMinifier.os/npm/node_modules/meteor/fastMinifier/node_modules/meteor-package-install-swc/.swc/node_modules/@swc/core/index.js:373:21)
at MeteorBabelMinifier._minifyWithSwc
(packages/fastMinifier_plugin.js:72:16)
at MeteorBabelMinifier.minifyOneFile
(packages/fastMinifier_plugin.js:121:19)
at packages/zodern_caching-minifier.js:77:23
at Function.Profile.time (packages/zodern_caching-minifier.js:34:5)
at MeteorBabelMinifier.minifyFile
(packages/zodern_caching-minifier.js:76:15)
at packages/fastMinifier_plugin.js:183:27
at Function.Profile.time (packages/fastMinifier_plugin.js:35:7)
at packages/fastMinifier_plugin.js:182:17
at Array.forEach (<anonymous>)
at MeteorBabelMinifier.<anonymous> (packages/fastMinifier_plugin.js:163:9)
at MeteorBabelMinifier.processFilesForBundle
(packages/fastMinifier_plugin.js:31:21)
=> Your application has errors. Waiting for file change.
```
</details>
The reason seems to be a reference to `import.meta` in the package [ffmpeg](https://www.npmjs.com/package/@ffmpeg/ffmpeg), which is [dynamically imported](https://github.com/samhirtarif/react-audio-recorder/blob/1c5298cf29aaf9cd6415180a37ee14ca36ccba70/src/components/AudioRecordingComponent.tsx#L72) by the package [react-audio-voice-recorder](https://www.npmjs.com/package/react-audio-voice-recorder)
Its reproducible in a base meteor react app, with just react-audio-voice-recorder installed and imported. You mentioned on a [meteor ticket](https://github.com/meteor/meteor/issues/12324) that "Meteor has never supported import.meta", but since it is working in meteor 2.10 and also in 3.0.3 with the standard minifier, I thought it might be fixable in this case.
Make sure your project is set up to use ES modules correctly, as that might resolve the issue.
You might also want to check your Meteor and package versions to ensure compatibility. If you havenβt already, consider looking at the minifierβs GitHub issues page for any related discussions or workarounds. It could be helpful to see if others have faced similar challenges.
1 Like