-
-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark Angular component as "standalone: false" #2746
Comments
@Martinspire: that's gonna be a tough nut to crack, since Angular 19 is still only being used by a very small number of projects compared to earlier versions that have no standalone support: https://www.npmjs.com/package/@angular/core?activeTab=versions As such, I'd rather leave |
@karsa-mistmere I think we're not on the same page here. Let me elaborate. My point is not to make the project standalone. My point is to make sure its not. By using standalone: false you are actually keeping it backwards compatible. Right now it stops working when you use stuff like ng-mocks (or other mocking solutions) because Angular assumes that lucide is standalone, when it is actually part of an NgModule. With Angular v19, they moved from assuming components are not standalone, to assuming they are. Thus everybody that used standalone could remove the It should be a small fix that has no effect for people that are not standalone. The standalone migration for this project itself, is something that I would love to see, but I understand why it hasn't happened yet. |
I understood what you meant, it's just that we cannot add |
But if it doesn't exist, they won't be updating either, since other dependencies would also break? And if you do not make the change, the result is that the current project then doesn't support Angular 19. Part of migrating to the new Angular version is the standalone flag, so any project moving to that, will want it reflected. Standalone flag was introduced in Angular 14 in 2022. Its not that new for projects to start using it, even if they don't want to migrate to 19 yet. And if this change isn't made, the only option for me is to either fork it or to use the static library instead. Because this project then has no future for me if standalone isn't properly supported. Requiring Angular 14 isn't too much of a breaking change I'd say. But I can also live with a separate component that works with standalone. I don't need it to be the exact same name anyway. If the component is now called |
Since our Angular package doesn't rely on exporting separate icon components per icon, we intend to decouple the business logic from the icons themselves, providing a standalone icon component and related injection tokens and services as part of a new In the future people could use import { XIcon } from '@lucide/icons';
import { LucideIconComponent } from '@lucide/angular';
@Component({
selector: 'app-foobar',
standalone: true, // omitted in Angular v19
imports: [LucideIconComponent],
template: `<lucide-icon [img]="XIcon"/>`,
})
export class FoobarComponent {
protected readonly XIcon = XIcon;
} or when using icon providers as some currently do: import { X } from '@lucide/icons';
import { LucideIconComponent, provideLucideIcons } from '@lucide/angular';
@Component({
selector: 'app-foobar',
standalone: true, // omitted in Angular v19
imports: [LucideIconComponent],
template: `<lucide-icon name="x"/>`,
providers: [provideLucideIcons({X})],
})
export class FoobarComponent {
} |
@karsa-mistmere ok sure, but that isn't available yet, right? Not even a beta? Or a fork for v19? |
Package
Version
0.473.0
Can you reproduce this in the latest version?
Browser
Operating system
Description
With Angular 19, all components are assumed to be Standalone. But while the version is supported as a dependency, the component is still breaking support by not explicitly setting standalone.
Since the issue about making the library standalone isn't going anywhere and lots of stuff is planned but not yet executed, there's issues with the current approach for when you want to write tests.
In Angular its common to use NG-Mocks for testing, but that currently doesn't know that the component is standalone. It gives a similar error as this: help-me-mom/ng-mocks#10762 for Lucide
There's a discussion happening with ng-mocks but no real solution is out yet, but this project should still set the value to make sure people also know it isn't a standalone dependency yet.
Steps to reproduce
Checklist
The text was updated successfully, but these errors were encountered: