Skip to content

Comments

Refactor plugin import to use Blob URLs#3787

Closed
mtt-artis wants to merge 3 commits intoopral:mainfrom
mtt-artis:mtt-artis-patch-1
Closed

Refactor plugin import to use Blob URLs#3787
mtt-artis wants to merge 3 commits intoopral:mainfrom
mtt-artis:mtt-artis-patch-1

Conversation

@mtt-artis
Copy link

Hi 👋

I have the error below with the current implementation

WARN  [paraglide-js] PluginImportError: Couldn't import the plugin "./project.inlang/plugin-message-format.js":

ResolveMessage: NameTooLong while resolving package 'data:application/javascript,var%20Un%3DOb...

the use of URL.createObjectURL works better in my case

thanks

@changeset-bot
Copy link

changeset-bot bot commented Dec 16, 2025

⚠️ No Changeset found

Latest commit: 77e28ea

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

@nx-cloud
Copy link

nx-cloud bot commented Dec 16, 2025

View your CI Pipeline Execution ↗ for commit 77e28ea

Command Status Duration Result
nx run-many --target=test --parallel ❌ Failed 1m 26s View ↗
nx run-many --target=lint --parallel ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-12-16 20:21:40 UTC

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 1082 to 1086
const blob = new Blob([moduleAsText], { type: 'application/javascript' });
const blobUrl = URL.createObjectURL(blob);
const { default: plugin } = await import(
/* @vite-ignore */ blobUrl
);

Choose a reason for hiding this comment

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

P1 Badge Avoid blob URLs for loading local plugins

Local plugins are now imported via Blob URLs (lines 1082–1086), but Node’s ESM loader only supports file:, data: and node: schemes; attempting import(blobUrl) throws ERR_UNSUPPORTED_ESM_URL_SCHEME before any plugin code runs, so loadProjectFromDirectory will fail for every non-HTTP plugin in a Node environment where this function is used. The previous data: import path worked under Node, so this change regresses plugin loading.

Useful? React with 👍 / 👎.

Copy link
Author

Choose a reason for hiding this comment

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

👍

works with bun

@mtt-artis
Copy link
Author

sorry, just find out this is a bun issue

oven-sh/bun#20374

@mtt-artis mtt-artis closed this Dec 16, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2025
@mtt-artis mtt-artis reopened this Dec 16, 2025
@samuelstroschein
Copy link
Member

@mtt-artis Do i understand the code correctly as "only changes import behavior for bun" and you tested that it works?

@samuelstroschein
Copy link
Member

Released as @inlang/sdk v2.4.10 and Paraglide JS v2.7.1.

@mtt-artis thanks for the PR! I had to backport this to an old branch. The target branch in this PR already contained an unpublished new version of the inlang SDK.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants