Closed
Description
Describe the bug
A bug that appears in next.241 for me.
Reproduction
I was unable to replicate it on the repl
This code:
<script lang="ts" context="module">
import _ from 'lodash';
export const b = _.cloneDeep({ f: '' });
</script>
Causes the error "ReferenceError: Cannot access '_' before initialization"
In my project - for any library, not just lodash.
It only happens in svelte 5 version 241
Svelte 5 version 240 and earlier does not have this issue.
It only happens with npm run dev
npm run build works fine
Logs
ReferenceError: Cannot access '_' before initialization
System Info
System:
OS: macOS 13.5
CPU: (8) arm64 Apple M1
Memory: 93.67 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.12.0 - /usr/local/bin/node
npm: 10.5.0 - /usr/local/bin/npm
Browsers:
Chrome: 128.0.6613.86
Safari: 16.6
npmPackages:
svelte: 5.0.0-next.241 => 5.0.0-next.241
Severity
blocking an upgrade