Skip to content

Support importing local .json files in ImportResolver (#288) - #291

Open
Yash990-bit wants to merge 1 commit into
jupyterlab:mainfrom
Yash990-bit:support-local-json-imports
Open

Yash990-bit wants to merge 1 commit into
jupyterlab:mainfrom
Yash990-bit:support-local-json-imports

Conversation

@Yash990-bit

Copy link
Copy Markdown

Summary

Fixes #288.

This PR adds support for importing local .json files in Plugin Playground's ImportResolver.

Problem

Previously:

  1. _localImportCandidates only probed .ts, .tsx, .js, .css, and their index.* variants. Importing without explicit .json extension failed resolution.
  2. _resolveLocalFile only handled .css and .svg. Any .json file fell through to dynamicLoader which treated it as TypeScript code, leading to transpile or runtime evaluation errors.

Solution

  • Added .json and index.json to _localImportCandidates in src/resolver.ts.
  • Added _loadLocalJson in ImportResolver to parse JSON and export both default and named properties (consistent with wheel asset module loading in src/wheel.ts).
  • Added an integration test in ui-tests/tests/plugin-playground.spec.ts testing default and named imports from local JSON files.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Preview environments for this pull request:

Preview Lab Notebook v7
Binder Binder Binder Notebook v7
JupyterLite JupyterLite JupyterLite Notebook v7

@Yash990-bit

Copy link
Copy Markdown
Author

Hi @Darshan808 when you get chance please review these

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Support importing local .json files in Plugin Playground (ImportResolver)

1 participant