Skip to content

Can't seem to get main example working #160

Closed Answered by JumpLink
C-Loftus asked this question in Q&A
Discussion options

You must be logged in to vote

@C-Loftus you need to run the example with the gjs -m flag to enable ESM Module support. Also, the @girs/* imports can only be used with a bundler like esbuild, GJS itself has no support for NPM modules, so you will need a bundler to resolve this for you.

Use the types in your JavaScript project

However, you can still use the types in the way you are trying to without needing a bundler or the TypeScript compiler. To do this, you need to create a jsconfig.json (note that this is not a tsconfig.json but a jsconfig.json) and add the @girs/* types there, for example like this:

{
  "compilerOptions": {
    "checkJs": true,
    "types": ["@girs/gjs", "@girs/gjs/dom", "@girs/gio-2.0", "@girs/gob…

Replies: 5 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by C-Loftus
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@C-Loftus
Comment options

@JumpLink
Comment options

@C-Loftus
Comment options

@C-Loftus
Comment options

@JumpLink
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants