Skip to content

Conversation

@chenjiahan
Copy link
Member

Summary

  • add JSON rule to handle imports with raw query (e.g., "foo.json?raw")
  • update asset plugin to process JSON files with raw query as asset/source
  • add test cases for raw JSON imports

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings October 26, 2025 11:24
@netlify
Copy link

netlify bot commented Oct 26, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 444e480
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68fe04e7b7be5e0008ea98b7
😎 Deploy Preview https://deploy-preview-6438--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 66 (🟢 up 8 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

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 adds support for importing JSON files with the ?raw query parameter, allowing developers to load JSON content as raw text strings instead of parsed objects. This addresses issue #6426 by implementing a new rule in the asset plugin to handle these imports.

Key Changes:

  • Added a JSON rule in the asset plugin to process ?raw query imports as asset/source type
  • Added the JSON rule identifier to the CHAIN_ID constants
  • Created comprehensive E2E tests to verify raw JSON imports work correctly

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/core/src/plugins/asset.ts Implements JSON raw query handling logic with new rule and updated comment
packages/core/src/configChain.ts Adds JSON constant to CHAIN_ID for rule identification
e2e/cases/assets/import-json-raw-query/* Adds test files and assertions for raw JSON import functionality
packages/core/tests/snapshots/* Updates snapshots to reflect new JSON rule in bundler configurations
packages/compat/webpack/tests/snapshots/* Updates webpack compatibility snapshots with new JSON rule

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

@chenjiahan chenjiahan merged commit a26e73e into main Oct 26, 2025
12 checks passed
@chenjiahan chenjiahan deleted the raw_json_1026 branch October 26, 2025 11:33
@chenjiahan chenjiahan mentioned this pull request Oct 30, 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.

[Bug]: Unable to import json files with ?raw suffix as raw strings

2 participants