Adding packages from yarnpkg

I am trying to use a package from yarnpkg. When I use it in my extension, the front-end does not load.
My question is, where do I install this package? There is package.json in browser-app/, custom-extension/ and main root directory. Also, am I missing something else?
I am using theia extension generator to generate an empty extension.

@usmnzain do you mind sharing some additional details, like any logs you notice in the console when attempting to start the application and it is in a loading state? In addition, please be sure to use the latest version of the generator if not already done so as it contains fixes like removing any use of deprecated dependencies.

If your extension requires a dependency, it would be the only package.json required to update.

If the extension is public (ex: hosted on a GitHub repository), I can further help you troubleshoot the issue.

The console only shows app listening on https://localhost:3000, nothing else. Also no errors in lerna-debug.log file. I am using the latest version of generator.

I am trying to use the serialport library inside a custom extension in the frontend. I have listed it in my package.json inside my extension folder (not browser-app or electron-app folder).

@usmnzain by checking the console for logs I mean the dev tools console when the app is trying to start (errors should be displayed in the application if anything is incorrect), not the terminal from which the backend is started. The serialport dependency looks like a nodejs paackage, it would therefore not be possible to use it in the frontend of your extension as you described.

Is there a way to use nodejs packages with theia ?

If you use nodejs APIs or packages it would need to be the backend not the frontend part of the extension:

1 Like