Open SaalkT opened 1 year ago
happens on next js, while rendering on the server side. maybe there's some kind of protection from reinitialization can be implemented
@AlonMiz were you able to find a workaround?
@dmaccormack this is more of a bug rather than enhancement
.
tonyxiao yes i've added an alias to my tsconfig
{
"compilerOptions": {
"paths": {
// Creates 500s on our app when initializing
// https://github.com/jsonurl/jsonurl-js/issues/614
"@jsonurl/jsonurl": ["./node_modules/@jsonurl/jsonurl/dist/jsonurl.noproto"]
},
// ... more config
}
but that doesn't work for javascript right?
but that doesn't work for javascript right?
@tonyxiao try this
import JsonURL from '@jsonurl/dist/jsonurl.noproto';
or with require
const JsonURL = require('@jsonurl/dist/jsonurl.noproto');
Hmm that doesn't work in typescript anymore because there's no typedefinition for jsonurl.noproto
Speaking of which what does noproto mean anywyas?
This issue is till not fixed. This happens server side on my Gatsby website. Please fix asap.
There's a discrepancy between the source: https://github.com/jsonurl/jsonurl-js/blob/v1.1.8/src/JsonURL.js#L1832 And the packaged code: https://www.runpkg.com/?@jsonurl/jsonurl@1.1.8/dist/jsonurl.noproto.js#2281
Hi, @SaalkT. You're correct that the toJsonURL property can not be redefined, but it can be defined on a per-instance basis during object creation. See this test for an example: https://github.com/jsonurl/jsonurl-js/blob/main/test/stringify.test.js#L181
Would that be sufficient for your use case?