sites icon indicating copy to clipboard operation
sites copied to clipboard

REPL provides wrong dependency version

Open trash-and-fire opened this issue 4 years ago • 3 comments

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]

trash-and-fire avatar Oct 01 '21 19:10 trash-and-fire

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.

non25 avatar Oct 01 '21 19:10 non25

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

dkwolfe4 avatar Oct 05 '21 23:10 dkwolfe4

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?

trash-and-fire avatar Oct 09 '21 21:10 trash-and-fire