wmr icon indicating copy to clipboard operation
wmr copied to clipboard

How to import a specific version of package from npm?

Open beizhedenglong opened this issue 4 years ago • 4 comments

beizhedenglong avatar Dec 03 '20 11:12 beizhedenglong

With npm or yarn (or whatever package manager you're using) you can install specific versions via:

npm install <package>@<version>

Example: npm install [email protected]

marvinhagemeister avatar Dec 03 '20 11:12 marvinhagemeister

Does wmr support to import a specific version of package without installation? something like: import '[email protected]'

beizhedenglong avatar Dec 03 '20 11:12 beizhedenglong

Just tried it out and it looks like it's not supported.

marvinhagemeister avatar Dec 03 '20 11:12 marvinhagemeister

Hmm - importing with a version should already be supported, but it does seem like we've mucked something up here.

FWIW you can use the "resolutions" or "dependencies" package.json fields to control versioning and WMR will respect that:

{
  "dependencies": {
    "preact": "^10.5.7"
  },
  "resolutions": {
    "unistore": "3.0.0",
    "@material/*": "5"
  }
}

developit avatar Dec 03 '20 21:12 developit