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

webpack-settings

v0.0.1

Published

Example of webpack with es6 loader

Downloads

1

Readme

Webpack-settings Build Status

Create applications using webpack with minimum configuration.

Why Use This?

This module has been created to remove some complexity and "re-configuration" when you want to develop a new application using webpack features. At the same time, it allow you to expand or override the default configurations as you need.

Installation

  • Install module
npm install -D webpack-settings
  • Create webpack.config.js in your project
import { setup } from 'webpack-settings'

module.exports = setup();

What’s Inside?

  • utilities
  • webpack configuration
    • Setup
    • Utils
    • Plugins
  • webpack-dev-server configuration
  • html-webpack-plugin
  • extract-text-plugin
  • Babel using the latest ES6 features

This will export as npm module the following:

  • Setup
  • Utils
  • Plugins

Setup

The provided setup allow to define the default properties present on the library, namely, paths and plugins. To know what each property can receive, check their topic.

Example:

Simple usage
webpack.config.js

import { setup } from 'webpack-settings'

module.exports = setup();

Advanced usage
webpack.config.js

import path from 'path'
import webpack from 'webpack'
import { setup } from 'webpack-settings'
const BASEDIR = process.cwd()

module.exports = setup({
  paths: {
    ENTRY_POINT: {
      application: path.resolve(BASEDIR, 'src/application')
      backoffice: path.resolve(BASEDIR, 'src/backoffice'),
    },
  },
  plugins: {
    production: [
      new webpack.optimize.UglifyJsPlugin({
        compress: { warnings: false },
      }),
    ]
  },
});

Utils

The module is composed by a set of utilities, namely for paths and flags.

Flags

If you need to extend or override some configuration, these flags can be usefull. The flags that are beeing exported are:

  • IS_DEV
  • IS_PROD
  • IS_WATCH
  • IS_TEST
Paths

For the paths, the following paths variables are beeing exported:

  • PUBLIC_DIR => /
  • DEV_DIR => [EXECUTION_PATH]/src
  • DIST_DIR => [EXECUTION_PATH]/dist
  • ENTRYPOINT => Use for entry property in webpack.config.js. With this approach, it can allow to have a single or multiple entrypoints
{
  app: path.resolve(BASEDIR, 'src/app')
}

Note: These can be changed when initializing configuration file

Plugins

These are exporting three groups of plugins, development, for development and for production By default, the main configuration are using these plugins by default. This can be usefull if you want to extend any of them and inject them into the main configuration.

Common
Development
Production
  • native UglifyJsPlugin

Todo List

  • Add tests
  • Allow to pass loaders through setup
  • Allow to pass webpack-dev-server object configuration