-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Svelte 5 error "Cannot access '_' before initialization" in version 241 #13081
Comments
This actually is reproducible on the REPL, in that the client-side compiled JS for the above component is: export const b = _.cloneDeep({ f: '' });
import * as $ from "svelte/internal/client";
import _ from 'lodash';
export default function App($$anchor, $$props) {
$.push($$props, false);
$.init();
$.pop();
} Interestingly, the server-side compiled version is fine. |
cc @benmccann, likely a result of #13048 |
oof. yeah, that's no good. thanks for letting me know. I'd be happy to take a look at it, but it looks like @paoloricciuti beat me to it. Thanks @paoloricciuti! |
No problem at all... I'm not 100% confident with the elegance of my solution but it works |
Describe the bug
A bug that appears in next.241 for me.
Reproduction
I was unable to replicate it on the repl
This code:
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
The text was updated successfully, but these errors were encountered: