npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-cli-customizer-ratedejuice

v1.0.5

Published

A small command-line Node module that allows Angular CLI's Webpack config file to be customized

Downloads

1

Readme

angular-cli-customizer

A small command-line Node module that allows Angular CLI's Webpack config file to be customized

Installation

npm install @angular/cli -g
npm install angular-cli-customizer -g

Usage

  1. Define a webpack.config.js file at the root of your project containing the Webpack configuration settings you wish modify/add to the Angular CLI's build:
const path = require('path');

module.exports = {
    resolve: {
        alias: {

            // all upgraded AngularJS modules will now be forced to
            // use the same version of AngularJS, removing the
            // "Tried to load angular more than once." warning.
            angular: path.resolve(__dirname, 'node_modules/angular')
        }
    }
};
  1. Use the command line interface exposed by this module - cng (think "customized" ng) - exactly as you would with the @angular/cli module (ng):
cng serve --open

API

The cng command is simply a wrapper for the ng command, so its API is identical to the standard ng command!

Why is this necessary?

Angular's CLI is a fantastic tool for generating and developing Angular applications. Unfortunately, it has one major flaw - at the time of writing, there is no way to customize or extend the CLI's stock functionality. Even though the Angular CLI is built on top of the infinitely configurable Webpack, the CLI doesn't allow its internal Webpack configuration to be altered.

What does this module do?

This module does some acrobatics (modifying the require function) to surgically replace the internal function (buildConfig()) that is responsible for generating the CLI's Webpack configuration object. The replacement function takes the result of the original buildConfig() call, merges in any changes defined in the custom webpack.config.js file, and returns the merged result.

Other than that, the cng command is simply a wrapper for the ng command.

How do I know what to modify?

If you run ng eject, the Angular CLI will create a webpack.config.js file at the root of your project's directory that contains the configuration it uses at runtime. You can use this file as a reference when designing your own webpack.config.js file that will augment this configuration.

Note that running ng eject prevents the usage of some CLI features; to "uneject", delete the generated webpack.config.js and flip the ejected property to false in your project's .angular.cli.json.

Isn't this a hack?

Yep. It depends on internal implementation details of the CLI, which could change during any update of the @angular/cli package. Hopefully a better customization solution will be eventually be built into the CLI.