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

ng eject not available at Angular 6.0.0 #10618

Closed
andygup opened this Issue May 3, 2018 · 32 comments

Comments

Projects
None yet
@andygup

andygup commented May 3, 2018

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 #10593

@hansl

This comment has been minimized.

Collaborator

hansl commented May 4, 2018

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

@tinganho

This comment has been minimized.

tinganho commented May 21, 2018

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.

@raffaeler

This comment has been minimized.

raffaeler commented May 21, 2018

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

@Fabyao

This comment has been minimized.

Fabyao commented May 22, 2018

@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.

@biiiipy

This comment has been minimized.

biiiipy commented Jun 19, 2018

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.

@raffaeler

This comment has been minimized.

raffaeler commented Jun 19, 2018

@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 ...

@lillylykho

This comment has been minimized.

lillylykho commented Jul 1, 2018

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

@meltedspark

This comment has been minimized.

meltedspark commented Jul 2, 2018

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.

@raffaeler

This comment has been minimized.

raffaeler commented Jul 2, 2018

@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.

@lmessinger

This comment has been minimized.

lmessinger commented Jul 9, 2018

+1

@envil

This comment has been minimized.

envil commented Jul 12, 2018

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

@Hertox82

This comment has been minimized.

Hertox82 commented Jul 13, 2018

+1

@lmessinger

This comment has been minimized.

lmessinger commented Jul 16, 2018

@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?

@meltedspark

This comment has been minimized.

meltedspark commented Jul 16, 2018

@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?

@splincode

This comment has been minimized.

splincode commented Jul 16, 2018

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

@lmessinger

This comment has been minimized.

lmessinger commented Jul 16, 2018

@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

@splincode

This comment has been minimized.

splincode commented Jul 16, 2018

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

@jkc1996

This comment has been minimized.

jkc1996 commented Jul 18, 2018

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.

@splincode

This comment has been minimized.

@Quppa

This comment has been minimized.

Quppa commented Aug 8, 2018

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

@lmessinger

This comment has been minimized.

lmessinger commented Aug 8, 2018

I've moved to https://github.com/meltedspark/angular-cli-builders, seems a good solution

@mrdulin

This comment has been minimized.

mrdulin commented Sep 11, 2018

Angular CLI: 6.0.8
Need custom webpack config feature!

@MartinJHammer

This comment has been minimized.

MartinJHammer commented Sep 25, 2018

My team needs the newest version of uglify-js (getting "Name expected" error with current uglify js version) when using ng-packagr with the angular cli, but this is not possible because of ng eject being disabled. Have tried @meltedspark plugin, but this does not work with ng-packagr (does work excellently with standard angular though).

We have to do big work arounds to make things work now.

Hope this will be resolved soon.

@andygup

This comment has been minimized.

andygup commented Sep 25, 2018

@hansl will ng eject be in 7.0.0? It's not in beta 4: https://github.com/angular/angular-cli/releases/tag/v7.0.0-beta.4.

Can you assign someone and update the milestone for this issue?

@clydin

This comment has been minimized.

Member

clydin commented Sep 28, 2018

eject functionality is no longer available in the latest version (6.x+). For custom webpack configurations the following unofficial add-on is a suggested solution: https://github.com/manfredsteyer/ngx-build-plus

@clydin clydin closed this Sep 28, 2018

@biiiipy

This comment has been minimized.

biiiipy commented Sep 29, 2018

And I thought angular team cared about community. Silently killing a crucial extension point (although a flawed one), and outsourcing to unofficial (read unsupported) hacklibrary without notice and no community discussion. That's just great...
This is a classic example why frameworks are nice only while they don't screw anything up. And more often than not, they all at some point do it. +1 reason to start looking at vue/react, thanks.

@clydin

This comment has been minimized.

Member

clydin commented Oct 1, 2018

Please note that the linked project above is not a hack. It is currently using an experimental extension API that will become stable in 8.0 that allows extensive customization and extension to the build process.
Eject is a one-way process and pushes full responsibility of upkeep and maintenance onto the application developer. In contrast, the package above allows the inclusion of additional webpack plugins or loaders while still leveraging the existing CLI experience and improvements.
In addition, if the goal of a project is for a fully standalone webpack configuration, there are a multitude of Webpack based starter projects available to cater to that need as well.

@MartinJHammer

This comment has been minimized.

MartinJHammer commented Oct 1, 2018

@clydin Do you know how well the package you mention works with ng-packagr and the general ng g application and ng g library cli commands? My team needs to modify how webpack works in conjuction with these and ng-packagr, as we need a newer version of uglify js to fix some errors.

Just your 5 bucks if you know anything :)

@biiiipy

This comment has been minimized.

biiiipy commented Oct 1, 2018

@clydin nice to hear! That sounds like a more solid solution, I hope that the API is wide enough so we can leverage it with confidence.
The problem that remains is that:

  1. This should have been deprecated until a viable solution is provided and not break people's apps.
  2. Removing it in v6 and reintroducing it as stable in v8 is a 12 month gap. Angular was supposed to be rock solid enterprise ready, no (read - limited) breaking change framework (with all the talk of pushing every commit through all tests in all google angular apps etc...), but this doesn't look like it.

Anyway, I hope that this will get better in the future :) thanks!

@meltedspark

This comment has been minimized.

meltedspark commented Oct 1, 2018

@MartinJHammer I can't tell you about ng-packagr but from what it looks like, @angular-builders/custom-webpack is more capable than ngx-build-plus. At least for now.
Mostly from webpack plugins perspective but not only (for example it supports different merge strategies).
Anyways my intention is to support this library as a long term alternative to ng eject so you are welcome to open a feature request for ng-packager if it doesn't work out of the box.
You're even more welcome to create a PR.

@MartinJHammer

This comment has been minimized.

MartinJHammer commented Oct 4, 2018

@meltedspark My boss ended up designing another solution for now, so I won't be able to make a PR this time around. But when the time comes, I'll definitely have custom-webpack in mind :)

BTW thanks so much for making an awesome extension :)

@Kingwl

This comment has been minimized.

Kingwl commented Oct 15, 2018

any update here?🤷🏻‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment