Skip to content

Migration From Fractal Required mandelbrot Interop #438

Description

@wesleyboar

Steps to reproduce the issue

  1. Upgrade project from Fractal v1.5 to Fractality v1.6.

  2. Notice it may add fs-extra as a dev dependency:
    (user error; fixed in TACC/Core-Styles#596)

    Resolved / Nevermind

    @fractality/mandelbrot imports fs-extra in its runtime code (src/theme.js), but its own published dependencies list does not include fs-extra (only js-beautify and lodash). That means resolution can fail depending on install layout/hoisting rules. Adding fs-extra directly to [the client] repo ("fs-extra": "^11.3.3") makes the dependency explicit and stable for our build/runtime path.

  3. Start Fractality.

  4. TypeError: mandelbrot is not a function

    Adding default-export interop in fractality.config.js fixed error.

    Details

    @fractality/mandelbrot is ESM and exports a default function. In CommonJS (require(...)), that comes back as a namespace object with a .default property, not a callable function directly. So old-style usage (const mandelbrot = require(...)) throws TypeError: mandelbrot is not a function; the interop line fixes this by using mandelbrotPackage.default || mandelbrotPackage.
    — A.I.

    Commands Run:

    npm view @fractality/mandelbrot dependencies peerDependencies --json
    node -e "const m=require('@fractality/mandelbrot'); ..."
    node -e "const mandelbrot=require('@fractality/mandelbrot'); mandelbrot({}) ..."
    

    Captured Outputs:

    npm view @fractality/mandelbrot dependencies peerDependencies
    --json
    {
      "dependencies": {
        "js-beautify": "^1.15.1",
        "lodash": "^4.17.21"
      },
      "peerDependencies": {
        "@fractality/fractality": ">= 1.5 < 2"
      }
    }
    $ node -e "const m=require(\"@fractality/mandelbrot\"); console
    .log(Object.keys(m)); console.log(typeof m.default); console.lo
    g(typeof m);"
    [ '__esModule', 'default' ]
    function
    object
    $ node -e "const mandelbrot=require(\"@fractality/mandelbrot\")
    ; try { mandelbrot({}); } catch (e) { console.log(e.toString())
    ; }"
    TypeError: mandelbrot is not a function
    

Reproduces how often:

Each time I use wesleyboar/Core-Styles#2 without interop.

Reduced test case

Context

  • Fractality version:

    ├── @fractality/fractality@1.6.3
    ├─┬ @fractality/handlebars@1.4.3
    │ └── @fractality/fractality@1.6.3 deduped
    └─┬ @fractality/mandelbrot@1.12.3
      └── @fractality/fractality@1.6.3 deduped
    
  • Node version: v25.4.0

  • OS: macOS 15.7.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions