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
Sveltekit is using the twind browser module in worker script, which is causing an error where document is undefined. This error is preventing the twind install function from running properly.
ReferenceError: document is not defined
at getStyleElement (/Users/.../node_modules/@twind/src/sheets.ts:6:15)
at cssom (/Users/.../node_modules/@twind/src/sheets.ts:29:11)
at getSheet (/Users/.../node_modules/@twind/src/sheets.ts:181:86)
at sheet (/Users/.../node_modules/@twind/src/install.ts:33:11)
at setup (/Users/.../node_modules/@twind/src/runtime.ts:130:67)
at eV (/Users/.../node_modules/@twind/src/install.ts:27:10)
at .svelte-kit/output/server/entries/pages/_layout.ts.js (/Users/.../.svelte-kit/output/server/entries/pages/_layout.ts.js:19:1)
at __init (/private/var/folders/9t/gvy_vyd1721gjwcmrmlp03t80000gn/T/tmp-68294-pXtmS4gX2vT3/srrsik229vh.js:29:56)
at .svelte-kit/output/server/nodes/0.js (/Users/.../.svelte-kit/output/server/nodes/0.js:1:1)
at __init (/private/var/folders/9t/gvy_vyd1721gjwcmrmlp03t80000gn/T/tmp-68294-pXtmS4gX2vT3/srrsik229vh.js:29:56)
After the last version of @sveltejs/adapter-cloudflare and @sveltejs/kit was released, they changed to use esm-env to detect the browser environment. However, the esbuild target platform was set to browser, which caused the use of the twind browser module in server code. This led to the error where document is undefined and the failure of the twind install function.
The text was updated successfully, but these errors were encountered:
0x221A
changed the title
[Bug]: Sveltekit with adapter-cloudflare is using the twind browser module in server code
[Bug]: Sveltekit with adapter-cloudflare is using the twind browser module in worker script
Dec 14, 2022
Reproduction
install
functionDescribe the bug
Sveltekit is using the twind browser module in worker script, which is causing an error where
document
is undefined. This error is preventing the twindinstall
function from running properly.Severity
serious, but I can work around it
System Info
Additional Information
After the last version of @sveltejs/adapter-cloudflare and @sveltejs/kit was released, they changed to use
esm-env
to detect the browser environment. However, the esbuild target platform was set tobrowser
, which caused the use of the twind browser module in server code. This led to the error wheredocument
is undefined and the failure of the twindinstall
function.The text was updated successfully, but these errors were encountered: