Skip to content

fix: introduce post-packaging fixing of js imports#483

Merged
gka merged 7 commits intomainfrom
fix/use-js-extensions
Feb 22, 2026
Merged

fix: introduce post-packaging fixing of js imports#483
gka merged 7 commits intomainfrom
fix/use-js-extensions

Conversation

@gka
Copy link
Copy Markdown
Contributor

@gka gka commented Feb 22, 2026

the Svelte Playground/REPL import of SveltePlot fails when we're importing TS files without the JS extension.

This pull request introduces a post-packaging script to automatically fix missing .js extensions in relative imports within the dist/ directory, ensuring compatibility with strict ESM environments. It also adds the magic-string dependency for efficient code rewriting and updates the packaging workflow. The previous script for checking missing .js extensions is removed in favor of the new automated fixer.

Packaging and Build Process Improvements:

  • The prepack script in package.json now runs scripts/fix-js-imports.js after svelte-package, automating the correction of import extensions in the dist/ output.
  • Added the magic-string dependency to package.json and pnpm-lock.yaml for advanced string manipulation during import rewriting. [1] [2]

Script Changes:

  • Added scripts/fix-js-imports.js, a script that scans files in dist/, detects extensionless relative imports, and rewrites them to fully specified .js or /index.js paths using magic-string.
  • Removed scripts/check-js-extensions.js, which previously only checked for missing .js extensions without fixing them.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 22, 2026

Deploy Preview for svelteplot ready!

Name Link
🔨 Latest commit 61c0218
🔍 Latest deploy log https://app.netlify.com/projects/svelteplot/deploys/699aeef62e595e00080a53e7
😎 Deploy Preview https://deploy-preview-483--svelteplot.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.

@github-actions
Copy link
Copy Markdown

📦 Preview package for this PR is published!

Version: 0.10.3-pr-483.0

Install it with:

npm install svelteplot@pr-483
# or install the specific version
npm install svelteplot@0.10.3-pr-483.0

@github-actions
Copy link
Copy Markdown

📦 Preview package for this PR is published!

Version: 0.10.3-pr-483.1

Install it with:

npm install svelteplot@pr-483
# or install the specific version
npm install svelteplot@0.10.3-pr-483.1

@github-actions
Copy link
Copy Markdown

📦 Preview package for this PR is published!

Version: 0.10.3-pr-483.2

Install it with:

npm install svelteplot@pr-483
# or install the specific version
npm install svelteplot@0.10.3-pr-483.2

@gka gka changed the title fix: make sure to use proper .js extensions in imports for svelte repl fix: introduce post-packaging fixing of js imports Feb 22, 2026
@github-actions
Copy link
Copy Markdown

📦 Preview package for this PR is published!

Version: 0.10.3-pr-483.3

Install it with:

npm install svelteplot@pr-483
# or install the specific version
npm install svelteplot@0.10.3-pr-483.3

@gka gka merged commit 4226f3e into main Feb 22, 2026
9 checks passed
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

Successfully merging this pull request may close these issues.

1 participant