question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import packages from arbitrary URL

See original GitHub issue

This is a feature request as an extension of https://github.com/stackblitz/core/issues/36 . It would be great if we could load packages that are not yet published to NPM, but are built and hosted locally.

More specifically, while developing NPM packages, our team is using SystemJS in Plunker, and using localhost URLs to fetch specific packages from the local machine (which hosts them). This allows us to author documentation and test that the examples run in StackBlitz before publishing changes to a package. More generally, this allows StackBlitz to be used during the development of the package, not only when consuming one.

Do you think that this workflow can be achieved with StackBlitz?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
EricSimonscommented, May 21, 2018

@gyoshev definitely- we’re actually taking this use case into consideration as we’ve been refactoring our bundler this month. Hoping to have this all online sometime in June 👍

In the meantime, one short term solution would be manually adding a pointer to the local UMD in your stackblitz project:

SystemJS.config({
  map: {
    '@stackblitz/sdk': 'https://cdn.jsdelivr.net/npm/@stackblitz/sdk@1.2.0'
  }
})

SystemJS.import('@stackblitz/sdk').then((sdk) => {
  // Run code that requires your lib here!
  console.log('loaded SDK', sdk)
})

Lmk if you have any q’s about the above & I’ll keep you in the loop as we get closer to our new bundler going online!

2reactions
oliviertassinaricommented, May 15, 2022

On MUI, we could use this feature with codesandbox CI. For instance, in https://deploy-preview-32779--material-ui.netlify.app/material-ui/react-button/#basic-button Screenshot 2022-05-16 at 00 58 18

compare the behavior of the button when we try to use this dependency:

  "@mui/material": "https://pkg.csb.dev/mui/material-ui/commit/a1d45cd1/@mui/material",
Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I import a module dynamically given the full path?
For Python 3.5+ use (docs): import importlib.util import sys spec = importlib.util.spec_from_file_location("module.name", "/path/to/file.py") foo ...
Read more >
Python Language Tutorial => Import modules from an arbitrary...
Learn Python Language - Import modules from an arbitrary filesystem location.
Read more >
Loading packages — Version 0.21.3 - Pyodide
Installing wheels from arbitrary URLs# ... Micropip decides whether a file is a URL based on whether it ends in “.whl” or not....
Read more >
Load module directly from a URL is very cute #195 - GitHub
Go imports are downloaded by the go get tool, which the user must explicitly run. · Go packages are downloaded into the Go...
Read more >
Python import: Advanced Techniques and Tips
Modules have a namespace containing arbitrary Python objects. Modules are loaded into Python by the process of importing. (Source).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found