• This repository has been archived on 18/Jun/2019
  • Stars
    star
    252
  • Rank 155,991 (Top 4 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Helps to load, extend and merge webpack configs

NPM version Travis build status AppVeyor build status Code Climate Maintainability Code Climate Coverage Dependency Status Development Dependency Status Greenkeeper badge

webpack-config

Helps to load, extend and merge webpack configs

Installation

npm install webpack-config --save-dev

or

yarn add webpack-config --dev

Features

  • #extend() - Helps to extend config using local file or shareable config
  • #merge() - Helps to merge some values into config and overrides existing ones
  • #defaults() - Helps to add some values if they are missing
  • Supports environment variables under #extend(), #merge(), #defaults() methods
  • Supports process.env.* variables in addition to environment ones
  • Supports shareable configs via node-modules

Changelog

Details changes for each release are documented in the release notes and also in the wiki page.

Shareable Configs

You can publish your configs to npm using webpack-config- prefix for package name.

When you call #extend() method you may omit that prefix:

import Config from "webpack-config";

export default new Config().extend(
  "mdreizin/base",
  "mdreizin/css",
  "mdreizin/html",
  "webpack-config-mdreizin/json"
  // etc
);

Also I would recommend to add webpack and webpack-config keywords so other users can easily find your module.

Usage

./webpack.config.js

import Config, { environment } from "webpack-config";

environment.setAll({
  env: () => process.env.NODE_ENV
});

// Also you may use `'conf/webpack.[NODE_ENV].config.js'`
export default new Config().extend("conf/webpack.[env].config.js");

./conf/webpack.base.config.js

import ExtractTextPlugin from "extract-text-webpack-plugin";
import Config from "webpack-config";

const extractCss = new ExtractTextPlugin("[name].css");

export default new Config().merge({
  output: {
    filename: "[name].js"
  },
  resolve: {
    root: [__dirname],
    modulesDirectories: ["node_modules"]
  },
  plugins: [extractCss],
  module: {
    loaders: [
      {
        test: /\.less$/,
        loader: extractCss.extract("style", ["css", "less"])
      }
    ]
  }
});

./conf/webpack.development.config.js

import webpack from "webpack";
import Config from "webpack-config";

export default new Config().extend("conf/webpack.base.config.js").merge({
  debug: true,
  devtool: "#source-map",
  output: {
    pathinfo: true
  },
  entry: {
    app: ["src/index.js", "src/index.less"],
    vendor: ["lodash"]
  },
  plugins: [new webpack.optimize.CommonsChunkPlugin("vendor", "vendor.js")]
});

./conf/webpack.production.config.js

import webpack from "webpack";
import Config from "webpack-config";

export default new Config()
  .extend({
    "conf/webpack.development.config.js": config => {
      delete config.debug;
      delete config.devtool;
      delete config.output.pathinfo;

      return config;
    }
  })
  .merge({
    plugins: [
      new webpack.optimize.DedupePlugin(),
      new webpack.optimize.OccurrenceOrderPlugin(true),
      new webpack.optimize.UglifyJsPlugin({
        mangle: true,
        output: {
          comments: false
        },
        compress: {
          warnings: false
        }
      })
    ]
  });

More Repositories

1

ossapps

A non-exhaustive list of open sourced clock faces, applications and modules from the community.
470
star
2

golden-gate

Framework to connect wearables and other IoT devices to mobile phones, tablets and PCs with an IP-based protocol stack over Bluetooth Low Energy
C
291
star
3

sdk-hr-meter

Fitbit SDK example application.
JavaScript
78
star
4

sdk-design-assets

Downloadable design assets for the Fitbit SDK.
77
star
5

sdk-oauth

Fitbit SDK example application.
JavaScript
71
star
6

sdk-bart

Fitbit SDK example application.
JavaScript
64
star
7

sdk-moment

SDK version of the 'Moment' clock face by Fitbit.
JavaScript
61
star
8

bitgatt

The FitbitGatt API is designed to provide a strong state machine around all Android gatt operations with the aim of making Android BLE development across Android vendors as straightforward and side-effect free as possible.
Java
56
star
9

sdk-lcd-clock

Fitbit SDK example application.
JavaScript
51
star
10

fitbit-sdk-toolchain

Toolchain for building Fitbit apps
TypeScript
49
star
11

webpack-cluster

Helps to make parallel webpack compilation easily
JavaScript
32
star
12

thriftcli

Command line client for Thrift services
Python
30
star
13

jsonrpc-ts

A very flexible library for building JSON-RPC 2.0 endpoints
TypeScript
21
star
14

sdk-exercise

Fitbit SDK example application.
JavaScript
20
star
15

sdk-altimeter

Fitbit SDK example application.
JavaScript
20
star
16

sdk-ifttt-demo

Fitbit SDK example application.
JavaScript
19
star
17

developer-bridge

TypeScript implementations of the Fitbit Developer Bridge
TypeScript
18
star
18

create-fitbit-app

JavaScript
16
star
19

angular-translate-loader

"angular-translate" loader for webpack
JavaScript
15
star
20

sdk-multi-view

Fitbit SDK example application.
JavaScript
11
star
21

sdk-i18n

Fitbit SDK example application.
JavaScript
10
star
22

sdk-scientific

Fitbit SDK example application.
JavaScript
10
star
23

smartling

CLI to work with Smartling translations
Go
9
star
24

enhanced-properties-loader

*.properties loader for webpack
JavaScript
8
star
25

sdk-app-demo

Fitbit SDK example application.
JavaScript
8
star
26

sdk-photo-picker

Fitbit SDK example application.
JavaScript
7
star
27

sdk-image-clock

Fitbit SDK example application.
JavaScript
7
star
28

image-codec-txi

TXI image format encoder library
TypeScript
5
star
29

sdk-calendar-clock

Fitbit SDK example application.
JavaScript
5
star
30

HibernateConnectionProvider

Instrumented Hibernate Connection Provider
Java
3
star
31

sdk-weather-clock

Fitbit SDK example application.
JavaScript
2
star
32

homebrew-tap

Custom list of Homebrew formulae
Ruby
2
star
33

sdk-companion-gettext

TypeScript
2
star
34

stats-writer-webpack-plugin

Saves 'stats' object as is
JavaScript
2
star
35

portable-pixmap

Portable Pixmap PPM Decoder
TypeScript
1
star
36

FitbitSummerSchool2019

Supporting materials for Fitbit Summer School 2019
Java
1
star