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

Import packages from arbitrary URL #437

Open
gyoshev opened this issue Apr 24, 2018 · 6 comments
Open

Import packages from arbitrary URL #437

gyoshev opened this issue Apr 24, 2018 · 6 comments

Comments

@gyoshev
Copy link

gyoshev commented Apr 24, 2018

This is a feature request as an extension of #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?

@EricSimons
Copy link
Member

This definitely could be achieved in stackblitz- we actually had it enabled for the first few months we were online, but had to turn it off after some bundler upgrades :)

One thing that's been an issue w/ stackblitz<->local is that most folks don't have https set up for their localhost, which is a problem bc stackblitz domains are all https and thus can't access unsecured resources (i.e. http). Would this also be a blocker for you in the use case you described?

@gyoshev
Copy link
Author

gyoshev commented Apr 25, 2018

That’s not too inconvenient, I guess. Self-signed certificates have worked fine so far, and this can even be automated, if it is a repetitive step. It’s a small price to pay for the opportunity to test out packages before they are published :)

@gyoshev
Copy link
Author

gyoshev commented May 21, 2018

@EricSimons sorry to be a bother, but would this make it on the backlog? We would love to integrate this, as it will seriously simplify our code, and let us use StackBlitz on a daily basis.

If I can lend a hand in any way, please let me know. If I understand correctly this requires a change to the turbo-resolver to support local packages, but it appears that one cannot run StackBlitz locally and experiment at this point.

@EricSimons
Copy link
Member

@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!

@askbeka
Copy link

askbeka commented May 2, 2019

any news?

@oliviertassinari
Copy link

oliviertassinari commented 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",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants