Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .babelrc

This file was deleted.

13 changes: 12 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
module.exports = {
extends: ['scratch', 'scratch/node', 'scratch/es6']
extends: ['scratch', 'scratch/node', 'scratch/es6'],
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
sourceType: 'module',
ecmaFeatures: {
jsx: true
},
babelOptions: {
presets: ['@babel/preset-react']
}
}
};
35 changes: 35 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": true,
"dynamicImport": true,
"decorators": false
},
"transform": {
"react": {
"runtime": "classic",
"pragma": "React.createElement",
"pragmaFrag": "React.Fragment",
"throwIfNamespace": true,
"development": false,
"useBuiltins": false
}
}
},
"module": {
"type": "es6"
},
"env": {
"targets": {
"chrome": "102",
"edge": "18",
"firefox": "68",
"safari": "12",
"ios": "12"
},
"mode": "usage",
"coreJs": "2.5.7"
}
Comment on lines +24 to +34
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Search for core-js in package.json and package-lock.json
find . -maxdepth 2 -name "package*.json" -exec grep -l "core-js" {} \;

Repository: OmniBlocks/scratch-gui

Length of output: 100


🏁 Script executed:

# Check the .swcrc file to see the full configuration
cat -n .swcrc

Repository: OmniBlocks/scratch-gui

Length of output: 929


🌐 Web query:

SWC .swcrc env.coreJs supported versions format documentation

💡 Result:

In SWC .swcrc, env.coreJs is:

  • Type/format: a string (not a number). Example:

    {
      "env": { "mode": "entry", "coreJs": "3.22" }
    }

    (swc.rs)

  • What values are supported: any core-js version supported by SWC; SWC recommends specifying at least the minor version (e.g. "3.22"). If you set "3", SWC interprets it as "3.0", which may miss newer polyfills. (swc.rs)

  • When it applies: only when env.mode is "usage" or "entry" (similar to Babel’s useBuiltIns). (swc.rs)

  • Official docs page: SWC “Supported Browsers” configuration docs (includes env.coreJs). (swc.rs)

Citations:


🏁 Script executed:

# Extract core-js dependency information from package.json
cat package.json | jq '.dependencies.["core-js"], .devDependencies.["core-js"]'

Repository: OmniBlocks/scratch-gui

Length of output: 284


🏁 Script executed:

# Also check package-lock.json for core-js version details
cat package-lock.json | jq '.packages."node_modules/core-js".version' 2>/dev/null || cat package-lock.json | jq '.packages | keys[] | select(. | contains("core-js"))' | head -5

Repository: OmniBlocks/scratch-gui

Length of output: 73


🌐 Web query:

SWC core-js 2.5.7 support compatibility legacy

💡 Result:

SWC’s built-in polyfill injection (env.mode: "entry" / "usage" + env.coreJs) is designed to work with modern core-js lines (the SWC docs/examples show coreJs: "3.xx"; core-js docs also document SWC integration with coreJs: "4.0"), and there’s no documented/official support for targeting core-js 2.5.7 via SWC’s env.coreJs option. [1], [2]

What that means for core-js@2.5.7 (legacy):

  • If you must stay on core-js 2.x (e.g., very old/“ancient” engines like IE10-, Android 4.4-, etc.), you generally can’t rely on SWC’s env.coreJs mechanism—use manual polyfill entry imports (or a different toolchain) instead. Core-js 2.x explicitly targets very old browsers (IE6+, Android 2.3+, etc.). [3]
  • If your “legacy” requirement is more like IE11-era support, core-js recommends core-js 3 for older platforms (and notes core-js 4 drops “ancient engines” and targets ~IE11 baseline). So in practice, migrating off 2.5.7 → 3.x is the compatibility path most aligned with SWC. [4]

Practical recommendation: For “legacy but not ancient” (e.g., IE11), move to core-js@3 and set SWC env.coreJs to a specific minor like "3.22" (as SWC recommends). [1], [4]

Sources:
[1] SWC docs – Supported Browsers / env.coreJs option https://swc.rs/docs/configuration/supported-browsers
[2] core-js docs – SWC integration example (coreJs “4.0”) https://core-js.io/web/docs/usage.html
[3] core-js 2.x npm page (supported engines list) https://www.npmjs.com/package/core-js/v/2.5.6
[4] core-js docs – guidance on core-js 3 vs 4 baseline/legacy support https://core-js.io/v4/docs/engines


Migrate from core-js 2.5.7 to core-js 3.x for proper SWC polyfill injection.

SWC's env.coreJs mechanism only supports core-js 3+ (with examples showing 3.22+) and 4.0+. Core-js 2.5.7 is legacy and not officially supported, meaning polyfills configured in env.mode: "usage" will not be properly injected. Update package.json to use core-js 3, and set "coreJs": "3.22" (or the appropriate minor version) in .swcrc.

🤖 Prompt for AI Agents
In @.swcrc around lines 21 - 31, Update the SWC config and dependency to use
core-js 3.x so SWC can inject polyfills: change the .swcrc env.coreJs value from
"2.5.7" to a supported 3.x version (e.g. "3.22") and update package.json to
depend on core-js ^3.22 (then reinstall to update lockfile). Keep env.mode:
"usage" as-is so SWC can perform usage-based polyfill injection, and verify no
other tooling expects core-js v2.

}
Loading
Loading