-
Notifications
You must be signed in to change notification settings - Fork 114
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
vite: TypeError: Cannot set properties of undefined (setting 'j') #31
Comments
probably a bug in pnpm clean install with the npm version
now getting
from node_modules/.pnpm/[email protected]/node_modules/debug/src/browser.js?v=c753326f module.exports = __require_for_vite_Aa8yeq.default || __require_for_vite_Aa8yeq(exports);
const { formatters } = module.exports;
formatters.j = function(v) {
try {
return JSON.stringify(v);
} catch (error) {
return "[UnexpectedJSONParseError]: " + error.message;
}
}; → ideally use an esm version of the debug module |
fixed by using rollup https://github.com/milahu/svelte-jsoneditor-template cost: 30 sec + 10 sec with rollup config |
it does, but the prepare should build the package = produce |
working vite template in https://github.com/milahu/svelte-jsoneditor-template |
Thanks @milahu for looking into this. I have to find some time to read your comments and understand the issue. Is this related to the known issues that sveltekit+vite have with non-ES libraries (see sveltejs/kit#928)? For that I found a workaround described in the readme: https://github.com/josdejong/svelte-jsoneditor#sveltekit-setup |
multiple issues
with the currently im not using this (svelte-jsoneditor) |
Wow that's quite a list 😅 Since SvelteKit is still in beta, and there are known issues with Vite and commonjs packages, I think it makes sense to wait until those issues are sorted out before putting a lot of effort into workarounds. If specifically the |
the workarounds are working, so the only effort is copy-paste
i would want my library to be usable not "perfect" ... but hey, its your library ; ) |
Yes, this will solve the issues you're having with your pnpm setup. But there are plenty of different setups and built tools and circumstances all having their own quirks, I want to be careful not ending up with a huge patchwork 😅. If the |
i have to admit, my sveltekit workaround requires posix shell ... give me two seconds |
Thanks for sharing. So this is a prepare script that you can use if you are using pnpm? |
Will close this issue now due to inactivity, feel free to reopen if this is still an issue. |
TLDR: how to actually use this library? 0__o
... project template?
when i run the example json_schema_validation.svelte, i get the error
from
svelte-jsoneditor/src/lib/components/modals/popup/AbsolutePopup.svelte
Line 4 in 8e5aecf
backtrace
looks like a problem with vite and commonjs ...
reproduce
related
also pnpm does not run the
prepare
script when i install from git ...The text was updated successfully, but these errors were encountered: