question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng eject: for dev and prod, why you need to generate several configs

See original GitHub issue

Completely different command (generate different configs):

$ ng eject 
$ ng eject --prod

This is very inconvenient, it is impossible to configure configurations. Why do not you use one config for everything using webpack-profiles? Or something convenient for easy configuration of webpack?

https://www.npmjs.com/package/webpack-profiles

var webpack = require('webpack');
module.exports = {
   
   common: {


   },

    production: {
        vars: { //section with variables passed to webpack.DefinePlugin 
            API_URL: "'http://my.api.com'"
        },
        config: { //section with config merged with main webpack config 
            devtool: 'source-map',
            plugins: [
                new webpack.optimize.UglifyJsPlugin()
            ]
        }
    },
    dev: {
        activeByDefault: true, // profile will be triggered if no profiles passed via cmd or options 
        vars: {
            API_URL: "'http://localhost:8080'"
        },
        config: {
            devtool: eval
        }
    },
    ...
};

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
robwormaldcommented, Feb 20, 2018

The entire webpack config in a CLI app is built up dynamically, so there are no webpack files, as such. The ejected webpack configs are basically just a dump of the internal state, they’re not hand-coded. Given that our primary goal is to keep you IN the CLI, we’re unlikely to devote a huge amount of time to making this too much easier.

If you’ve got a better idea, we’re all ears, but with this basic constraint: we are not interested in keeping things “in sync” - that is, having a separate webpack config file we have to synchronize/keep up to date every time we make a change to the CLI mechanics. Any additional dependencies have to be tested, kept up to date, license verified, etc etc.

If complete control of Webpack is something you want, then we suggest using the standalone @ngtools/webpack package in your own Webpack setup. While I appreciate that may be inconvenient for you, it’s equally inconvenient for us to maintain and track an ever growing list of dependencies for a feature we want to avoid you using in the first place!

0reactions
angular-automatic-lock-bot[bot]commented, Sep 7, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support multiple environments in the same build angular 2
We are building one war file to run the application. There are two environments on which it needs to run - "dev" and...
Read more >
Building and serving Angular apps
You can define different named build configurations for your project, such as staging and production, with different defaults. Each named configuration can ...
Read more >
How To Build An Angular App Once And Deploy It To Multiple ...
The best solution is to load environment-specific configurations from a backend or from the local assets folder if you do not have control...
Read more >
How to manage different environments with Angular CLI ...
All of these builds will likely require a different config: Different server URLs, different logging options, etc. Then you have to create the...
Read more >
How To Use Custom webpack Configurations with Angular ...
npm install --save-dev @angular-builders/custom-webpack @10.0.1. Copy. At this point you should have an Angular project generated by Angular CLI ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found