stackblitz / stackblitz/starters

Import errors with Angular 21, Signal Forms and other sub modules

Open
#102 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
151
Forks
96
Avg merge
9d 6h
Merged PRs (30d)
2

Description

Hi, I'm not sure if this is the right repository to share this issue with.
Anyway, I have a problem to run examples using Angular 21, problems that I never had until Angular 20 (and 21 next 2).
i'm not using Web Container / Node (that work instead) but I prefer the "old" client side approach because it's faster to load.

It seems to be having trouble importing submodules like:

Main.ts:

import { provideHttpClient, withFetch } from '@angular/common/http';

in any component:

import { form, FormField } from '@angular/forms/signals';

The error is:

Cannot find module '@angular/forms/signals' or its corresponding type declarations.

I created an example to reproduce the problem:
https://stackblitz.com/edit/angular-xtzhxq6u?devtoolsheight=75&file=src%2Fapp.ts,src%2Fmain.ts&theme=light
(The example works fine if i remove these imports from main.ts and app.ts)

I'm not sure but it seems the problem is with the secondary entrypoints of the "parent" library and the parent lib doesn't expose them (see image)

Image

Note: this is the package.json of @angular/forms package (from your Angular Starter Kit) and there is the signal/forms export :

{
  "name": "@angular/forms",
  "version": "21.1.0",
  "description": "Angular - directives and services for creating forms",
  "author": "angular",
  "license": "MIT",
  "engines": {
    "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
  },
  "dependencies": {
    "tslib": "^2.3.0",
    "@standard-schema/spec": "^1.0.0"
  },
  "peerDependencies": {
    "@angular/core": "21.1.0",
    "@angular/common": "21.1.0",
    "@angular/platform-browser": "21.1.0",
    "rxjs": "^6.5.3 || ^7.4.0"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/angular/angular.git",
    "directory": "packages/forms"
  },
  "angular": {
    "examples": {
      "format": "sqlite",
      "path": "./resources/code-examples.db"
    }
  },
  "ng-update": {
    "packageGroup": [
      "@angular/core",
      "@angular/bazel",
      "@angular/common",
      "@angular/compiler",
      "@angular/compiler-cli",
      "@angular/animations",
      "@angular/elements",
      "@angular/platform-browser",
      "@angular/platform-browser-dynamic",
      "@angular/forms",
      "@angular/platform-server",
      "@angular/upgrade",
      "@angular/router",
      "@angular/language-service",
      "@angular/localize",
      "@angular/service-worker"
    ]
  },
  "sideEffects": false,
  "module": "./fesm2022/forms.mjs",
  "typings": "./types/forms.d.ts",
  "type": "module",
  "exports": {
    "./package.json": {
      "default": "./package.json"
    },
    ".": {
      "types": "./types/forms.d.ts",
      "default": "./fesm2022/forms.mjs"
    },
    "./signals": {
      "types": "./types/signals.d.ts",
      "default": "./fesm2022/signals.mjs"
    },
    "./signals/compat": {
      "types": "./types/signals-compat.d.ts",
      "default": "./fesm2022/signals-compat.mjs"
    }
  }
}

Have you got any advice or do you know what is the problem?

Thank you
Fabio

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction and inspect src/main.ts and src/app.ts, where the @angular/common/http and @angular/forms/signals imports fail. Compare the starter's Angular package and export configuration with the shown @angular/forms package.json. Done means the client-side example loads with both imports present and no missing-module errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.