Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

Unable to use CAPI on stackblitz or codesandbox #1129

Open
josepot opened this issue Jul 5, 2023 · 12 comments
Open

Unable to use CAPI on stackblitz or codesandbox #1129

josepot opened this issue Jul 5, 2023 · 12 comments
Labels
ecosystem needs input We need input from the team and/or others

Comments

@josepot
Copy link
Contributor

josepot commented Jul 5, 2023

DEMO on a TS project

DEMO on a JS project

@josepot josepot added the bug Something is broken label Jul 5, 2023
@harrysolovay
Copy link
Contributor

Seems the specified Capi version in both of those is 0.0.1. Should be 0.1.0-gamma.1.

@josepot
Copy link
Contributor Author

josepot commented Jul 5, 2023

Seems the specified Capi version in both of those is 0.0.1. Should be 0.1.0-gamma.1.

Then perhaps the docs should be updated? Because npm i capi installs version 0.0.1

@harrysolovay
Copy link
Contributor

Perhaps in stackblitz it does. Doesn't on my machine.

@josepot
Copy link
Contributor Author

josepot commented Jul 5, 2023

Also installing version 0.1.0-gamma.1 on stackblitz produces the following error:

A FAILURE: PACKAGE NOT FOUND
Unable to find package @capi/westend-dev in the NPM registry.
Please try installing a different package name

@josepot josepot changed the title imports are broken? Unable to use CAPI on stackblitz Jul 5, 2023
@ryanleecode
Copy link
Contributor

Seems to be an issue with how they are runnning browser code... A node project is able to install capi

https://stackblitz.com/edit/stackblitz-starters-2u3qzv?file=index.js

@josepot
Copy link
Contributor Author

josepot commented Jul 5, 2023

Seems to be an issue with how they are runnning browser code... A node project is able to install capi

https://stackblitz.com/edit/stackblitz-starters-2u3qzv?file=index.js

to install it, yes. To run it: no 🙁. Try importing anything from CAPI and running it (it uses node 16, so...)

@tjjfvi
Copy link
Contributor

tjjfvi commented Jul 10, 2023

Looks like their browser setup doesn't correctly handle URL packages (which we use for codegen), and their node setup uses an old version of node. I don't see much we can do here 🤷

We'll eventually build a Capi playground (#1153) which should address some of these usecases.

@tjjfvi tjjfvi closed this as not planned Won't fix, can't repro, duplicate, stale Jul 10, 2023
@josepot
Copy link
Contributor Author

josepot commented Jul 10, 2023

Looks like their browser setup doesn't correctly handle URL packages (which we use for codegen), and their node setup uses an old version of node. I don't see much we can do here 🤷

We'll eventually build a Capi playground (#1153) which should address some of these usecases.

Hi @tjjfvi,

I wanted to put forward a suggestion regarding the issue at hand. It would be beneficial to leave the issue open until a viable alternative or solution is identified. In my opinion, keeping it open would be advantageous because the ability to quickly demonstrate issues or features in the browser holds immense value. My concern is that a CAPI playground might not adequately address the needs of the majority of use cases. For example, it might not be suitable for demonstrating node project setups, parcel project setups, vitejs setups, and more.

With that in mind, I kindly request that you reconsider reopening this issue and collaborate on devising an action plan for bundling CAPI in a manner that truly serves the community's needs. While a CAPI playground is a nice addition, it is crucial to address this urgent matter as I previously explained. The CAPI playground falls short in meeting the requirements of the majority of use cases, and as far as I am aware, there hasn't been significant interest expressed by anyone other than CAPI team members.

Thank you for considering this suggestion, and I look forward to working together to find the best solution.

@josepot josepot changed the title Unable to use CAPI on stackblitz Unable to use CAPI on stackblitz or codesandbox Jul 10, 2023
@tjjfvi
Copy link
Contributor

tjjfvi commented Jul 10, 2023

I'm not sure there's anything we can do to fix this, but I'll still reopen it to track the status. (Perhaps stackblitz will soon update their version of Node and unblock this.)

@tjjfvi tjjfvi reopened this Jul 10, 2023
@tjjfvi tjjfvi added ecosystem and removed bug Something is broken labels Jul 10, 2023
@josepot
Copy link
Contributor Author

josepot commented Jul 10, 2023

I'm not sure there's anything we can do to fix this, but I'll still reopen it to track the status. (Perhaps stackblitz will soon update their version of Node and unblock this.)

Could you please also look into why it doesn't work on codesandbox? 🙏

Also, the issue with stackblitz goes beyond node, as it can not be used on regular TS/JS projects, either. So, IMO that can (and IMO should) be fixed as it has to do with the way that the library is being packaged.

@ryanleecode
Copy link
Contributor

What is the error you are getting on codesandbox? Is it a TLA error?

image

@josepot
Copy link
Contributor Author

josepot commented Jul 11, 2023

What is the error you are getting on codesandbox? Is it a TLA error?

image

Try creating a TS sandbox from scratch, then install capi and then try to reproduce the code reported in this issue (which I wanted to illustrate with a codesandbox/stackblitz, but wasn't able to 😞)... The result is this.

There are at least 2 problems in there:

  1. Cannot find module 'capi' or its corresponding type declarations (and yes, moduleResolution is set to Node16)
  2. SyntaxError: await is only valid in async functions and the top level bodies of modules

@tjjfvi tjjfvi added the needs input We need input from the team and/or others label Jul 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ecosystem needs input We need input from the team and/or others
Projects
Status: Done
Development

No branches or pull requests

4 participants