-
Notifications
You must be signed in to change notification settings - Fork 12k
what is ng eject actually for? #6302
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
Are you asking what is for or suggesting the docs be updated to describe better what it does ? xD If its the former |
Yes you are spot on, needs a bit more documentation. Thanks for clarifying the question. Let me see if I understand the purpose and propose a doc update: If you want to use additional features of webpack that the CLI does not directly support. Use the `ng eject` command to create a webpack.config.js to add the extra features that the CLI does not directly support.All existing commands of the CLI will continue to work unaffected but the effect of the commands may be altered by your changes to the webpack.config.js file. (??) |
It does give you additional webpack features but only because if you eject building and dev server become your complete responsibility, meaning you lose the support of any updates that may come to
Another alternative would be:
|
@waratah |
I am new to angular-cli and am used to tinkering with webpack configuration manually. I like all of the commands ng provides. However, if I need to modify webpack by using ng eject, can I undo this later somehow? One of my scenarios is, and maybe this is a separate issue, is that I am trying to serve a .json file from the root of the application but I am receiving a 404. I thought that maybe if I ran ng eject, I could somehow manually add this file to the build? |
@PivotalAnimal you could theoretically undo However, if you are trying to load a json you might not need to eject your application. You could place it under Another option to load a JSON is to add a snippet like this one on
Then you'll be able to use bring the data into your |
My problem with the Update: a workaround I use is that I do eject for |
I'm pretty confused, I've run ng eject, and gotten the webpack config. Do I need to do another eject to get AoT support? (Have same requirement as comment below) |
I need some additional webpack config (e.g. loader or plugin) and continue development (watching without AOT) and also make prod (e.g. aot and env stuff) releases. |
@dave11mj , I refer to your example about using typings.d.ts for json files. |
First off: I totally see no point for But the
Beside the fact that I am forced to ultimately opt out from |
If you write documentation, you have to think whether other people will understand you. So as a noob i try to read about "ng eject" and what I see? Oh, it ejects app. And what does this "eject" mean? Really generates new webpack config based on provided options? I would think it stops application which was started with ng serve or anything like that. |
Hi, i am new to angular-cli and here is my scenario: I need to scan files local then generate some log files in app build stage, so I plan to write a custom webpack plugin to do this, can I use 'ng- eject' to load my custom webpack plugin ? Thanks ! |
Eject is a very useful command (or I would call it approach to build) which will let you do advanced builds and divorce amazing cli when needed. In my company we use ejected approach since we are running legacy AngularJS hand in hand with Angular, making it easier to build, test and deploy. |
@krizic Thank you! I will have a try : ) |
@krizic you are talking about a project that is not under angular-cli and can thus have its webpack config changed. One of the key problems with the concept behind |
@ohcibiI I am talking about project which is "under" angular-cli, once you eject webpack configuration (or several different ones e.g. prod, dev, legacy...) you are still able to use ng generators. Revert angular-cli.config to ejected:false should solve the issue you have. And yes you can have best of both worlds. |
@krizic i'm aware of that hack. But this is far from intuitive. It is also not an "issue I have", its a design flaw of angular-cli. The key problem is that the webpack-config is unnecessarily coupled with the rest of angular-cli. I explained that a bit more detailed some posts above. |
I am a newbie on angular-cli, so please do not throw rocks at me for what I am going to say! 😃 I guess the point of having webpack "coupled" with angular-cli, is that it let the Angular Team the freedom to change, if necessary, their package manager without having to worry about what impact it will have on the consumer (aka developers who just want to do "ng new HelloWorld"). |
Using @dave11mj lead, I'm using a similar setup to expose env vars to the app, see angular-lab#environment for details. |
If I've done 'ng eject' can I go back to making the cli take care of the bundling? edit: I didn't commit my changes yet so was just able to discard my changes ;) |
what does this mean I unassigned '@sumitarora' ??? |
@Stoffel-KT , you can undo
|
Has anyone managed to eject and remove .angular-cli.json? It seems like the angular/cli plugin which is required for unit tests is still reading from .angular-cli.json even after an eject which doesn't seem right to me. Thoughts? |
Hi guys, I'm not sure how to revert the eject process so does this steps are logical and help me what I like to do.
I like to know if this is possible. Does the last step when replace old package.json will know how to use the new version of webpack when I have added the new plugin? |
This issue is now obsolete due to changes in the recent releases. Eject is no longer supported. |
Which commit closes this? |
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. |
Bug Report or Feature Request (mark with an
x
)Versions.
documentation issue..
Repro steps.
Read ng eject and tell me what it is actually for. I have no idea why I need this command and what it actually does. There is an assumption I know what eject is.
The log given by the failure.
https://github.com/angular/angular-cli/wiki/eject
Desired functionality.
As a developer I understand the purpose of this command.
Mention any other details that might be useful.
The text was updated successfully, but these errors were encountered: