Skip to content
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

Cannot redefine property: toJsonURLText #614

Open
SaalkT opened this issue Mar 14, 2023 · 11 comments
Open

Cannot redefine property: toJsonURLText #614

SaalkT opened this issue Mar 14, 2023 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@SaalkT
Copy link

SaalkT commented Mar 14, 2023

No description provided.

@dmaccormack dmaccormack added the enhancement New feature or request label Sep 14, 2023
@dmaccormack dmaccormack self-assigned this Sep 14, 2023
@dmaccormack
Copy link
Collaborator

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?

@AlonMiz
Copy link

AlonMiz commented Dec 23, 2023

happens on next js, while rendering on the server side.
maybe there's some kind of protection from reinitialization can be implemented

@tonyxiao
Copy link

@AlonMiz were you able to find a workaround?

@tonyxiao
Copy link

@dmaccormack this is more of a bug rather than enhancement.

@AlonMiz
Copy link

AlonMiz commented Feb 23, 2024

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
}

@tonyxiao
Copy link

but that doesn't work for javascript right?

@AlonMiz
Copy link

AlonMiz commented Feb 24, 2024

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');

@tonyxiao
Copy link

Hmm that doesn't work in typescript anymore because there's no typedefinition for jsonurl.noproto

Speaking of which what does noproto mean anywyas?

@joe223
Copy link

joe223 commented Mar 6, 2024

#660

@ktheys
Copy link

ktheys commented Oct 15, 2024

This issue is till not fixed.
This happens server side on my Gatsby website.
Please fix asap.

@romulof
Copy link

romulof commented Nov 12, 2024

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/[email protected]/dist/jsonurl.noproto.js#2281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants