This repository was archived by the owner on Jan 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Error: [$injector:unpr] Unknown provider: i with Vite #26
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingfyiSome good-to-know insights preserved as living docsSome good-to-know insights preserved as living docshelp wantedExtra attention is neededExtra attention is needed
Description
Hi, I've been trying to upgrade our internal company project to match your template, everything went almost fine until I tried to make a build and serve it through vite serve. It gave me this error:

I understand that this happens because of minification by Vite, but there are 2 troubles:
- If I disable minification in Vite Config it still ads digits to places where we have similar providers in use (for example we use NavigationService in 2 components thus Vite will name second entry as NavigationService2 and it will break DI again).
- I could not find any piece of code in your repo which would help me fix this, because your cloned local project builds just okay without errors.
Since it's private repo I can't show code.(Moreover, I won't be able to create a Sandbox it will take a lot more time to do, so sorry).
But one important detail is that I kept my controllers, services and directives as function and did not convert them into ES6 classes.
Main question is: how to tell vite to make everything fine?
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
Providers are set correctly.
Current Behavior
Messes up providers during build with minification.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfyiSome good-to-know insights preserved as living docsSome good-to-know insights preserved as living docshelp wantedExtra attention is neededExtra attention is needed
