-
Notifications
You must be signed in to change notification settings - Fork 12k
beta.4/5 cannot resolve client classes (nor window) in environment.dev.ts #833
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
Comments
i tried removing all references to our classes, but then it died on a reference to 'window'. |
I think I know what's happening. The env files are being compiled in place instead of in the target directory, and because of that they can't find relative module paths. I'm working on a solution for this issue, using conditional module mapping via SystemJS rather than moving files around, I hope to have the PR ready later this week. |
To reproduce, simply add this to one of the env files:
leads to:
|
@filipesilva a declare unfortunately doesn't suffice... environment.prod.ts:
Build result:
line 24 is the call to injector.get() |
Yeah I don't think that the env files can be used to import services stuff in right now, due to how the module resolution is configured. I'm thinking of reworking it this week, but in the meanwhile the best advice I can give to use the newer betas is to set a variable for your environment in |
It did work until beta.5 :/. The problem with simply setting a flag is that we are forced to send all of our client-side mock data in prod builds if we do that. We could live with that if there's no other way, but... it worked fine before b5 :/. This setup allowed us to import the client-side mock (and its data) only in dev builds. Okay, i'll rework it to use no imports in environment, but that sorely limits the true utility of env.xxx.ts (as they're now effectively limited to holding only constant values). |
If you can wait a week-ish, I think I'll be able to have better env file support that should be able to fully cover your use-case. |
i can, but the project can't - we go in ~13 working days. i just discovered that 1.0.x doesn't work for us at all (-prod build succeeds but is missing files: see #847 for details), and am currently rolling back to 0.0.34. i will refactor our env to simply include everything and toggle it on or off - not a major problem. |
I haven't had a change to work more on this, but just want to link here a related issue: #933 |
Closed via #1455. Environments are now in the right folder. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Windows 10 (running in admin mode)
ng --version
. If there's nothing outputted, pleasedo on your code? etc.
we import client-side classes in environment.dev.ts. In angular-cli versions newer than 1.0.0-beta.1, those imports cannot be resolved at build-time. It also cannot resolve 'window', so it's not a problem with our classes.
Log
with 1.0.0-beta.1:
with 1.0.0-beta.4: (edit: same result with beta.5)
it's complaining about the first import it finds. It also cannot resolve 'window' or 'console'.
more information.
see above.
Works fine with 1.0.0-beta.1.
The text was updated successfully, but these errors were encountered: