angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng eject not available at Angular 6.0.0

Open andygup opened this issue 8 years ago • 36 comments

This is currently an undocumented breaking change for those migrating from 5 to 6, ng eject is temporarily disabled at v6.0.0.

Versions

Angular CLI: 6.0.0
Node: 9.11.1
OS: darwin x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

  • Try running ng eject

Observed behavior

Running ng eject resulted in the following message:

The 'eject' command has been temporarily disabled, as it is not yet compatible with the new
angular.json format. The new configuration format provides further flexibility to modify the
configuration of your workspace without ejecting. Ejection will be re-enabled in a future
release of the CLI.

If you need to eject today, use CLI 1.7 to eject your project.

Reference: https://github.com/angular/angular-cli/blob/master/packages/angular/cli/commands/eject.ts

Desired behavior

I wasn't aware of this issue until after I upgraded, note that I did read the release notes. Since ng eject has been removed for now, I expected supporting documentation:

  • Provide information on this in the README as a breaking change. This would help to let folks know about this issue before they attempt to migrate.

  • Provide guidance in the wiki: https://github.com/angular/angular-cli/wiki.

Mention any other details that might be useful (optional)

Possibly related to another issue https://github.com/angular/angular-cli/issues/10593

andygup avatar May 03 '18 22:05 andygup

Seems like we're missing an issue for eject, so keeping this one open.

hansl avatar May 04 '18 16:05 hansl

I think it would still be good to be able to eject. We want to follow whatever webpack convention that the default angular-cli uses, without really opting into angular-cli, because it is too opinionated and unflexible.

If there is no eject command maybe provide some info on the kinds of webpack plugins Angular uses.

tinganho avatar May 21 '18 07:05 tinganho

This basically means that it's not possible to use angular 6 with native plugins (which require a specific webpack loader) ... too bad :(

raffaeler avatar May 21 '18 10:05 raffaeler

@tinganho I agree with you, the CLI is unflexible . This have been discussed here #1656. @hansl locked the conversation which I think goes against community driven projects. @hansl would you reconsider re-opening the conversation so that the community can build/find/discuss CLI alternative? I personally use https://github.com/gdi2290/angular-starter which is CLI free.

Fabyao avatar May 22 '18 16:05 Fabyao

Yes, at this point Angular CLI is dangerously bad to rely on. If at some point some dependency breaks or you need some customization that angular CLI doesn't support, then you are screwed. And CLI should help you do hard, repetitive, standardized work, not lock you in. That's why I don't recommend anybody, apart from quick demos, to use CLI in their projects.

Also, "Eject" feature is kind of nice, but I think it shows the fundamental flaw with Angular CLI - it's either CLI or plain webpack. It doesn't enhance existing webpack pipeline, but tries to replace it with it's own high level construct, and that creates a lot of friction, lock-in, unnecessary compatibility problems etc, and in the end defeats it's own purpose.

biiiipy avatar Jun 19 '18 08:06 biiiipy

@biiiipy frankly, any change they make could screw all the things. And no, you cannot stay stable to a given version because npm audit still warns all of us that is extremely dangerous not to move on the newest possible versions. Checkmate ...

raffaeler avatar Jun 19 '18 08:06 raffaeler

Hi guys, is there an ETA on solving the missing ng eject option issue?

lillylykho avatar Jul 01 '18 14:07 lillylykho

Hi everyone, I really hope the CLI will be extensible in the nearest future.
For the time being I've created a small library that allows to extend the existing browser and server targets with a custom webpack config.
It worked for me (I needed node-loader for native modules and also some externals), hope it can help someone else.
You can find the example with native modules here.
More details in the related Medium story.

just-jeb avatar Jul 02 '18 06:07 just-jeb

@meltedspark First of all thank you for your contribution. On the other hand I am totally disappointed on the silence about this breaking changes. I am not going to adopt this version of Angular for the time being. And I am not going to adopt the million-th piece of javascript in addition to the 67K file for an empty application. Again, thanks but all of this is terrible.

raffaeler avatar Jul 02 '18 07:07 raffaeler

+1

lmessinger avatar Jul 09 '18 12:07 lmessinger

https://github.com/gdi2290/angular-starter has been updated to Angular 6, I think this's the best solution for now.

envil avatar Jul 12 '18 07:07 envil

+1

Hertox82 avatar Jul 13 '18 07:07 Hertox82

@meltedspark thanks for the opening our eyes to the option of extending the build. Until now, we've been ng-ejecting and then changing manually the webpack.config. As a quick question, how do you replace a plugin (eg AngularCompilerPlugin) rather then add one?

lmessinger avatar Jul 16 '18 09:07 lmessinger

@lmessinger thank the Angular team for rewriting Angular CLI to have that kind of flexibility 😊 Regarding your question, seems that this peace of functionality is currently missing from custom-webpack builders, but it's not a big deal to add it. I'm currently unavailable for a week, would you mind opening an issue and I'll take care of it once I'm available?

just-jeb avatar Jul 16 '18 11:07 just-jeb

@andygup https://github.com/Angular-RU/angular-cli-webpack This package provides an opportunity to modify @angular/cli project's webpack configuration without "ejecting".

splincode avatar Jul 16 '18 11:07 splincode

@splincode thanks - it's an alternative but it seems not to use angular-cli, but replace it with an alternative. so i do prefer something like @meltedspark is refering to. @meltedspark - thanks, i'll open a issue. can you describe meanwhile how you plan of doing it, i might be able to take a stab myself

lmessinger avatar Jul 16 '18 12:07 lmessinger

@lmessinger angular-cli-webpack allows writing directly on typescript (webpack.config.ts)

splincode avatar Jul 16 '18 13:07 splincode

can anyone tell when ng eject will be enabled again ? need webpack.config,js file for angular project immediately. or what else can i do to extract that file.

jkc1996 avatar Jul 18 '18 05:07 jkc1996

@jkc1996 today you can usage https://github.com/meltedspark/angular-cli-builders https://github.com/Angular-RU/angular-cli-webpack

splincode avatar Jul 18 '18 08:07 splincode

Are we likely to see this in 7.0? (I see the beta.0 tag was published recently.)

Quppa avatar Aug 08 '18 05:08 Quppa