Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPL provides wrong dependency version #136

Open
trash-and-fire opened this issue Oct 1, 2021 · 3 comments
Open

REPL provides wrong dependency version #136

trash-and-fire opened this issue Oct 1, 2021 · 3 comments
Labels
bug Something isn't working REPL

Comments

@trash-and-fire
Copy link

REPL ignores versions of dependencies in package.json of imported packages.

https://svelte.dev/repl/75f0b64a56dc4bffb387b08a4441ccde?version=3.43.1

The lightweight-charts requires [email protected] but REPL tries to provide the latest version [email protected]

@non25
Copy link

non25 commented Oct 1, 2021

This could silently break perfectly fine demo REPLs for complex published components without package maintainer ever noticing, unless someone post issue in the repo.
Sad state of things.

@dkwolfe4
Copy link

dkwolfe4 commented Oct 5, 2021

FWIW, I think that the issue was traced down to fancy-canvas being built with in a manner incompatible with the packaging library... see tradingview/lightweight-charts#488 and tradingview/lightweight-charts#613 The latter pull has not yet been incorporated into fancy-canvas as it breaks other TradingView software that depends on it.

@trash-and-fire
Copy link
Author

We debugged the problem and found an interesting feature.

A similar replay of another framework handles dependency versions correctly: https://malinajs.github.io/repl/#/share/VO7aIokP-Od. The difference is that it requests packages from UNPKG using ?module parameter. With this parameter, all dependency imports are replaced with imports with exact package versions.

For example https://unpkg.com/[email protected]/dist/lightweight-charts.esm.production.js?module contains import { bindToDevicePixelRatio as t } from "https://unpkg.com/[email protected]/coordinate-space?module" and https://unpkg.com/[email protected]/dist/lightweight-charts.esm.production.js contains just import{bindToDevicePixelRatio as t}from"fancy-canvas/coordinate-space"

Perhaps you should use this parameter in Svelte REPL too?

@Rich-Harris Rich-Harris transferred this issue from sveltejs/svelte-repl Dec 16, 2021
@Rich-Harris Rich-Harris added REPL bug Something isn't working labels Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working REPL
Projects
None yet
Development

No branches or pull requests

4 participants