Skip to content

Cross-package extensionless gjs/gts imports don't function as expected #993

@davidtaylorhq

Description

@davidtaylorhq

We have a library package which contains gjs/gts files, and we're importing those in an application package in the same monorepo. For js/ts files, those kind of cross-package extensionless imports work correctly. For gjs/gts they don't work.

Once declarations are built for the library package, then the extensionless gjs/gts imports are resolved correctly.

Here's a repository with a minimal example: https://github.com/davidtaylorhq/glint-monorepo-test

In app-package/src/start-here.ts, we have:

import JsButton from "library-package/components/js-button";
import TsButton from "library-package/components/ts-button";

import GjsButton from "library-package/components/gjs-button";
import GtsButton from "library-package/components/gts-button";

The first two resolve correctly all the time. The second two raise a 'Cannot find module' error. After building the declarations for library-package, all four resolve correctly.

CLI reproduction would be:

git clone https://github.com/davidtaylorhq/glint-monorepo-test
cd glint-monorepo-test
pnpm i

pnpm ember-tsc -b # Fails with two "cannot find module" errors for the app, but builds declarations for the library

pnpm ember-tsc -b # Succeeds, because now there are declarations on disk

rm -rf library-package/declarations

pnpm ember-tsc -b # Fails again

Ideally we want to be able to work on this monorepo without needing to emit declarations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions