Closed cetincakiroglu closed 1 year ago
Hi @cetincakiroglu. The example code you're showing seems wrong, since you're passing the files directly as keys of the project
object and not as keys in project.files
. Maybe just a mistake when pasting your example code here?
Looking at your example project, it looks like you're using the EngineBlock runtime environment. The .stackblitzrc
config only works in the WebContainers environment. More info on the differences:
https://developer.stackblitz.com/docs/platform/available-environments/
I'm also not sure why the dependencies you define in project.dependencies
are not listed in the sidebar and don't get installed on page load. They should be, so maybe that's a bug on our side. But to be sure I'd like to see a reproduction with the full code you're using to generate the sdk.openProject
call, or a reduced test case. You could fork this project and try to reproduce your issue in your fork maybe?
Hi @fvsch,
Sorry for typo, files are inside a files object
like this
project = {
....
files: {
...
}
}
Everything works except dependency install. I've already provided a reproduction link above in the issue. It's what happens when a user clicks on "Open in StackBlitz" button in our documentation.
Just wonder why dependencies cannot be installed other than a WebContainer project. Is there any configuration to do it, SDK documentation is so raw?
I've already provided a reproduction link above in the issue
To clarify: we need a reproduction link for the code that generates the project, not for the end result (the generated project).
Right now your result example is a project saved in our database with zero dependencies:
{
"dependencies": {
"jpack": {
"appDependencies": {},
"resDependencies": {}
},
"externalDeps": [],
"externalResources": []
}
}
To figure out how that result ended up in our database, we'll need to reproduce the sdk.openProject
call.
Just wonder why dependencies cannot be installed other than a WebContainer project.
They can, and it normally works; which is why we need a reproduction with a sdk.openProject
call that shows the same buggy result. :)
Hi @fvsch ,
Here is the forked example https://stackblitz.com/edit/sdk-create-project-fubkef?file=index.ts,index.html,templates%2Fjavascript.ts
So it looks like we indeed have a bug somewhere, that causes all dependencies to be dropped. We'll look into that!
Beyond this, there might be fixes that you could do to the dependency lists you're using in this project. Some issues I’m spotting:
project.dependencies
seems to contain a lot of dependencies that the project doesn't actually use, including gulp
and many gulp-*
packages.project.dependencies
and the dependencies in project.files['package.json']
don't seem to match at all.npm install
locally, it fails because the "dependencies"
in package.json are for Angular 14 packages, but the "devDependencies"
requests things like @angular/compiler@11.0.9
, which leads to some conflicts.I don't know if that will work around the bug we're seeing here or not, but it might help to clean up the dependencies you define, and to use the same dependencies in project.dependencies
and project.files['package.json']
.
Here is an example of using the SDK to generate an Angular 14 project that uses a single source of truth for dependencies: https://stackblitz.com/edit/sdk-angular-dependencies?file=project.ts
Thank you for your support and time @fvsch, I've removed some dependencies as you pointed and it seems it works now!
Excellent, I’m glad the workaround helped!
I made a copy of your reproduction project so that we can investigate it later and see what the underlying issue was.
Hi,
I'm trying to adapt StackBlitz SDK to generate dynamic component examples. I can load and open the project but cannot install dependencies on the initial load without clicking "install missing dependencies" even though I configured .stackblitzrc as in docs. Nothing happens.
Here is a reproducer. https://stackblitz.com/edit/angular-czlzjh?file=.stackblitzrc
Here is the related code