You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TLDR: The plugin converts script contents into base64 and restore it later. This approach can break prettier when enabled cursorOffset because prettier will then try to restore the cursor position with the diff package, which breaks in such large input (each base64 character is considered a single word).
Here's the minimal reproduction:
# initialize
mkdir test&&cdtest
npm init -y && npm i prettier prettier-plugin-svelte
# get a reasonably sized (11KB) svlete file
curl -O https://raw.githubusercontent.com/sveltejs/vite-plugin-svelte/main/packages/vite-plugin-svelte-inspector/src/runtime/Inspector.svelte
touch a.mjs # see below
Related: #301 #60
TLDR: The plugin converts script contents into base64 and restore it later. This approach can break prettier when enabled
cursorOffset
because prettier will then try to restore the cursor position with thediff
package, which breaks in such large input (each base64 character is considered a single word).Here's the minimal reproduction:
Run
node a.mjs
, it finishes in 300ms in my machine.Now, try uncomment
// cursorOffset: 0,
, this process will hang forever.Instructions about profile a node process and get flamegraph
Before continuing, update the script above to wait some seconds before it goes to hang, so that we could inspect into this process later.
Run
node --inspect a.mjs
, then openchrome://inspect
to run profile on it.The text was updated successfully, but these errors were encountered: