Repository navigation
Terser error: unknown field extractComments
#12087
Replies: 3 comments 1 reply
|
Sorry but it's impossible to do anything without a minimal repro. |
|
This error is coming from Rust/serde deserialization inside SWC ( SWC's minifier options parser is strict: it only recognizes the exact fields listed in your error ( Since this began right after replacing a downloadable ZIP file, two scenarios typically cause this: Cause 1: The ZIP File is Being Imported/Bundled as a Webpack ModuleIf the new ZIP asset was placed inside The Fix:Move the ZIP file to Docusaurus's dedicated
Files in Cause 2: Custom Webpack / Plugin ConfigurationIf any plugin or // Incorrect (causes SWC unknown field error):
new TerserPlugin({
terserOptions: {
extractComments: false, // <-- Invalid inside terserOptions
},
})
// Correct:
new TerserPlugin({
extractComments: false, // <-- Root-level option only
terserOptions: {
compress: true,
},
})Cause 3: Temporary Fallback for SWC MinimizerIf you are using Docusaurus's Faster flags in // docusaurus.config.js
module.exports = {
future: {
experimental_faster: {
swcJsMinimizer: false, // Uses standard Terser instead of SWC
},
},
};Moving the ZIP to |
Uh oh!
There was an error while loading. Please reload this page.
Builds are failing with multiple errors (example below):
Docusaurus v3.10.1.
At first I thought is was because I updated dependencies, but rolling back doesn't fix it. One previous deployment with the previous dependency tree worked.
The only other change from the previous deployment was I replaced a downloadable asset (a ZIP file). No pages or posts updated, no changes to my configuration.
I've tried deleting and reinstalling
node_modules; deleting thebuilddirectory and rebuilding, runningnpm ci; none of these work.FWIW,
npm run startworks for local production.All reactions