Skip to content

Svelte 5 migration script: Hangs in monorepo when builds of internal libraries exist and are used as the package exportsΒ #13422

@AlexAegis

Description

@AlexAegis

Describe the bug

So this is going to be pretty obscure, but maybe my odd setup will reveal something.

I have an older toy project (svelte 4, I keep it updated) and running the migration script on it makes the script hang indefinitely after processing a few files.

But with a fresh clone (git clone ...; npx svelte-migrate;) it didn't happen. I made a few copies of the original workspace and deleted the gitignored files expecting that maybe the old node_modules or .svelte-kit folder would cause problems, but it was the dist folders with the build output that was the culprit.

This only reproduces after the project gets built, which is probably only a problem in my setup. This project uses pnpm workspaces and each package's exports point towards the dist folder. Then turbo ensures that everything in the dependency tree gets built in order.

**/package.json

	"exports": {
		".": {
			"types": "./src/index.ts",
			"import": "./dist/index.js",
			"require": "./dist/index.cjs",
			"default": "./dist/index.js"
		},
		"./package.json": "./package.json"
	},

If there are no dist folders, the migration script finishes instantly with some expected(?) errors ($$props is used together with named props in a way that cannot be automatically migrated.) are shown. And it processes all .svelte files.

There's a clean up script in the project so you can quickly remove all dist folders with npx nuke --nukeList dist

Reproduction

git clone https://github.com/AlexAegis/minesweeper
git checkout 4a690fe884740fb9bfa89e235638137dcefecfc6 
cd minesweeper
pnpm i
pnpm build # important, without this the script finishes
npx svelte-migrate svelte-5
y
y

Logs

No response

System Info

System:
    OS: Linux 6.10 Arch Linux
    CPU: (32) x64 AMD Ryzen 9 7950X3D 16-Core Processor
    Memory: 56.55 GB / 62.01 GB
    Container: Yes
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - /run/user/1000/fnm_multishells/4109_1727504258876/bin/node
    Yarn: 1.22.22 - /run/user/1000/fnm_multishells/4109_1727504258876/bin/yarn
    npm: 10.8.3 - /run/user/1000/fnm_multishells/4109_1727504258876/bin/npm
    pnpm: 9.11.0 - /run/user/1000/fnm_multishells/4109_1727504258876/bin/pnpm
    bun: 1.1.28 - ~/.local/share/bun/bin/bun
  Browsers:
    Brave Browser: 129.1.70.119

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions