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

Import json directly instead of grunt.file.readJSON #1491

Closed
zepumph opened this issue Oct 15, 2024 · 3 comments
Closed

Import json directly instead of grunt.file.readJSON #1491

zepumph opened this issue Oct 15, 2024 · 3 comments
Assignees

Comments

@zepumph
Copy link
Member

zepumph commented Oct 15, 2024

From #1436, let's do something like this instead:

( async () => {
  console.log( 'loading' );
  try {
    const json = await import( './json.json');
    console.log( json.hi );
  }
  catch( e ) {
    console.log( 'e', e ); // Transform failed with 1 error:
  }
} )();

Following steps in here: https://stackoverflow.com/questions/48911030/import-json-in-typescript

Looks like we just need to add "resolveJsonModule": true to support it. Let's do that in tsconfig-node for now, since we don't have esModuleInterop turned on in sim code at the moment.

@zepumph
Copy link
Member Author

zepumph commented Oct 23, 2024

Or we can just use the loadJSON() function in perennial.

@zepumph zepumph changed the title Import json directly instead of grunt.file.json Import json directly instead of grunt.file.readJSON Oct 23, 2024
@zepumph
Copy link
Member Author

zepumph commented Oct 23, 2024

There are 30 usages or so of grunt.file.readJSON

@zepumph zepumph removed their assignment Oct 23, 2024
@samreid samreid self-assigned this Nov 8, 2024
samreid added a commit that referenced this issue Nov 8, 2024
samreid added a commit that referenced this issue Nov 8, 2024
samreid added a commit that referenced this issue Nov 8, 2024
samreid added a commit to phetsims/perennial that referenced this issue Nov 8, 2024
@samreid
Copy link
Member

samreid commented Nov 8, 2024

Fixed, closing.

@samreid samreid closed this as completed Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants