Skip to content

Comments

fix: should load json file correctly#702

Merged
9aoy merged 2 commits intomainfrom
load-json
Nov 19, 2025
Merged

fix: should load json file correctly#702
9aoy merged 2 commits intomainfrom
load-json

Conversation

@9aoy
Copy link
Collaborator

@9aoy 9aoy commented Nov 18, 2025

Summary

img_v3_02s5_8fab72d2-ad08-4fce-a55e-ac7e5d36058g

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings November 18, 2025 12:14
@netlify
Copy link

netlify bot commented Nov 18, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 06d121e
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/691c68881cc72300083c88ea
😎 Deploy Preview https://deploy-preview-702--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes JSON file loading by adding special handling for .json files in the dynamic import function. When a JSON file is imported, it now uses the Node.js import assertion with: { type: 'json' } to properly load the JSON content as a module.

Key changes:

  • Added conditional check for .json file extensions before the standard module import
  • Implemented JSON-specific import with proper import attributes

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/core/src/runtime/worker/loadModule.ts Added JSON file handling logic to dynamically import JSON files with the correct type assertion
e2e/test-api/test.json Added test fixture JSON file with a simple value property
e2e/test-api/json.test.ts Added end-to-end test to verify JSON imports work correctly for both dynamic and static imports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@9aoy 9aoy merged commit e144d74 into main Nov 19, 2025
39 of 46 checks passed
@9aoy 9aoy deleted the load-json branch November 19, 2025 06:06
@9aoy 9aoy mentioned this pull request Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant