Skip to content

Plugin system for webpack  #9949

@splincode

Description

@splincode

Hello, there are not enough extensions to develop on the webpack. Our team developed a utility for redefining plug-ins (working with .angular-cli.json) and a convenient addition for Angular:

https://github.com/Angular-RU/angular-cli-webpack

What do you think if angular-cli out of the box had the opportunity and could you give us this?

package.json

"start": "ng serve --webpack-config ngw.config.ts" # it works with .angular-cli.json

terminal

$ npm start

ngw.config.ts

import * as webpack from 'webpack';
import { WebpackConfigOptions as ConfigOptions } from '@angular/cli/models/webpack-config';
import { BuildOptions } from '@angular/cli/models/build-options';

export type Configuration = webpack.Configuration;
const DEFAULT_COMMAND = process.argv[2];

export default function (config: Configuration, options: ConfigOptions<BuildOptions>, argv) {
    const command = argv || DEFAULT_COMMAND;

    //common config modification
    ...

    switch(options.buildOptions.enviroment) {
      case 'prod':
       config = productionModificationsMerge(config);
      break;
     case 'dev':
      //etc
    }

    return config;
}

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureIssue that requests a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions