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

@alauda/custom-webpack

v5.2.1

Published

Custom webpack configuration with alauda dev server and other great features

Downloads

281

Readme

@alauda/custom-webpack

Custom webpack configuration with alauda dev server and other great features

What features are included?

  1. Seamlessly open browser on development, it will try its best to reuse opened browser tab, so that no more redundant browser tabs will be opened like webpack-dev-server --open
  2. If you've installed global console-cli, it will start the console backend server on development or serve on production mode. What means there will be no need to clone alauda-console and run make dev by yourself. Of course, you'll need to provide a console config file at ~/.consolerc.yml (or any other valid configuration supported by cosmiconfig) with authentication.oidc_client_secret, authentication.oidc_issuer_url and console.api_address.
  3. Restart console service automatically on configuration changes.
  4. Bundle with and inject service worker on production automatically.
  5. Proxy to alauda console automatically on development and serve on production mode.
  6. Provide html-minifier wrapper hm to minify index.html with common default options.
  7. dev-console server for development which enables auto-login and no cross-origin (a console config like ~/.consolerc.yml is required)
  8. Disable proxy api gateway for dev-console so that HTTP2 connection could be enabled for api gateway
  9. Change alauda console environment quickly with cce command for dev-console or console-cli
  10. Proxy with HTTPS support when running with ng serve --ssl

Upcoming Features

  • HTTP2 support

Other incredible features from you.

Usage

Simplest

  1. Install Dependencies:

    yarn add -D @alauda/custom-webpack @angular-builders/custom-webpack
  2. Config angular.json:

    // production
    {
      "builder": "@angular-builders/custom-webpack:browser",
      "options": {
        "customWebpackConfig": {
          "path": "node_modules/@alauda/custom-webpack"
        }
      }
    }
    // development
    {
      "builder": "@angular-builders/custom-webpack:dev-server"
    }
  3. Config ~/.consolerc.yml (required for console-cli or dev-console)

    authentication:
      http_proxy: proxy_url
      https_proxy: proxy_url
      no_proxy: localhost,127.0.0.1,0.0.0.0
      login: login
      password: password
    console:
      api_address: api_address
      use_platform_api: false # optional, turn true to use /console-platform/api
    defaultUser: # optional
      login: login
      password: password
    envs:
      - name: env_name # optional
        api_address: api_address # required
        login: login # optional, will fallback to #defaultUser.login
        password: password # optional, will fallback to #defaultUser.password
        use_platform_api: false # optional
  4. run ng serve, that's all, hope you like the development workflow.

Commands

Serve on production mode

yarn s

Minify index.html on building

// package.json
{
  "scripts": {
    "postbuild": "hm"
  }
}

Change console env

cce # you can choose to install `@alauda/custom-webpack` globally

? Which alauda console env do you want to use? …
a https://a.example.com (adminA)
b https://b.example.com (adminB)


cce - a # quickly change to specify env

List envs

cce list
activeEnv: a
┌─────────┬──────────┬─────────────────────────┬─────────────────┬───────────────────┬──────────────────┐
│ (index) │   name   │       api_address       │      login      │     password      │ use_platform_api │
├─────────┼──────────┼─────────────────────────┼─────────────────┼───────────────────┼──────────────────┤
│    0    │    'a'   │ 'https://a.example.com' │     'adminA'    │    'passwordA'    │                  │
│    1    │    'b'   │ 'https://b.example.com' │     'adminB'    │    'passwordB'    │       true       │
└─────────┴──────────┴─────────────────────────┴─────────────────┴───────────────────┴──────────────────┘

Advanced

If your need to custom the configuration again on top of @alauda/custom-webpack, you can simply provide a file named webpack.config.js, and config angular.json:

// production
{
  "builder": "@angular-builders/custom-webpack:browser",
  "options": {
    "customWebpackConfig": {
      "path": "webpack.config.js"
    }
  }
}
// webpack.config.js
import { createRequire } from 'node:module'

import customWebpack from '@alauda/custom-webpack'

const require = createRequire(import.meta.url)

export default config => {
  Object.assign(customWebpack(config).resolve.alias, {
    moment$: 'dayjs/esm',
    'moment-timezone$': require.resolve('./src/app/timezone'),
  })
  // mutate anything you want after calling `customWebpack(config)`
  return config
}

Environments

  • ALAUDA_DISABLE_LAZY_COMPILE: Whether to disable lazy compile on development.
  • ALAUDA_DISABLE_START_CONSOLE: Whether to disable starting console server automatically, not required if ALAUDA_ENABLE_DEV_CONSOLE is true
  • ALAUDA_ENABLE_DEV_CONSOLE: Whether to enable dev console server automatically (highly unrecommended).
  • ALAUDA_DISABLE_PROXY_API_GATEWAY: Whether to disable proxy api gateway, if true then the true api address will be used instead, ALAUDA_ENABLE_DEV_CONSOLE is required to take effect

Useful Internal API

  1. startConsole:

    Control when or whether to start the (dev) console server in background on spawn mode.

    import { startConsole } from '@alauda/custom-webpack/start-console'
  2. Anything you want us to expose?

LICENSE

ISC © Alauda