elderjs icon indicating copy to clipboard operation
elderjs copied to clipboard

1.6.5 Unexpected token l in JSON at position 2

Open timeshift92 opened this issue 2 years ago • 2 comments

I Have bug, after update elderjs version from 1.6.3 to 1.6.5

stack: 'SyntaxError: Unexpected token l in JSON at position 2\n at JSON.parse ()\n at Object.inlinePreprocessedSvelteComponent (C:\PROJECTS\Uztelecom\uztelecom\node_modules\@elderjs\elderjs\build\partialHydration\inlineSvelteComponent.js:18:89)\n at createReplacementString (C:\PROJECTS\Uztelecom\uztelecom\node_modules\@elderjs\elderjs\build\partialHydration\partialHydration.js:15:36)\n at C:\PROJECTS\Uztelecom\uztelecom\node_modules\@elderjs\elderjs\build\partialHydration\partialHydr…derjs\elderjs\build\partialHydration\partialHydration.js:22:28)\n at markup (C:\PROJECTS\Uztelecom\uztelecom\node_modules\@elderjs\elderjs\build\partialHydration\partialHydration.js:40:32)\n at process_markup (C:\PROJECTS\Uztelecom\uztelecom\node_modules\svelte\compiler.js:31608:30)\n at Object.preprocess (C:\PROJECTS\Uztelecom\uztelecom\node_modules\svelte\compiler.js:31638:37)\n at async C:\PROJECTS\Uztelecom\uztelecom\node_modules\@elderjs\elderjs\build\rollup\rollupPlugin.js:109:31'

timeshift92 avatar Dec 14 '21 12:12 timeshift92

I had the same error when I tried to upgrade to the latest version: Elder.js error in transform. SyntaxError: Unexpected token l in JSON at position 2

Downgraded to version 1.4.0

s-kris avatar Dec 15 '21 11:12 s-kris

I believe this is the same issue I had in https://github.com/Elderjs/elderjs/issues/226.

Basically, if you're including a Svelte component with hydrate-options you probably need to wrap the keys in quotes. If that fixes it for you, let me know and I'll PR a change to the docs - I had first been waiting for either confirmation from @nickreese that that's the right fix or confirmation from someone else that they had the same issue and can fix it the same way I did. :-)

apop880 avatar Dec 17 '21 01:12 apop880