1.0.3 • Published 8 years ago

webpack-fatigue-embrace v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Webpack Fatigue Embrace

Build fatigue webpack config

Installation

> npm install webpack-fatigue-embrace

Uses

webpack.config.js

// without any options
let builder = require('webpack-fatigue-embrace')

let options = {}
let customOptions = {}

let wfe = new builder(options, customOptions)

module.exports = wfe
// with options
let builder = require('webpack-fatigue-embrace')

let options = {
  libOnly: true, // if you want to use library you should use this options
  output: {
    library: 'WebpackFatigueEmbrace',
    libraryTarget: 'umd'
  },
  externals: [
    'react'
  ],
  plugins: {
    normal: [
      ['Define', { 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) }] // DefinePlugin
    ],
    optimize: [
      ['OccurrenceOrder'], // OccurrenceOrderPlugin
      ['UglifyJs', { compress: { warnings: false } }] // UglifyJs options
    ]
  }
}

let wfe = new WebapckFatigueEmbrace(options)
module.exports = wfe

Options

OptionsTypeDescriptionDefaultDone
envstringwebpack build envdevelopDone
entrystring/array/function(dir)setting entry point'./src/index.js'Done
vendorobjectsetting vendor object[]Done
outputobjectsetting output objectsupport 'path', 'filename', 'publicPath', 'library', 'libraryTarget'Done
modulearraysetting bundle loader{ test: /.js$/, exclude: /node_modules/, loader: 'babel' }Done
pluginsobjectsetting plugins{ plugins: { normal: [], optimize: [] } }Done

Plugin System

if you want to use webpack native plugin, you can just use module name like:

// use webpack native plugin without optimize
let options = {
  plugins: {
    normal: [
      ['Define', { 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) }] // DefinePlugin
    ]
  }
}

// with optimize
let options = {
  plugins: {
    optimize: [
      ['OccurrenceOrder'] // OccurrenceOrderPlugin
    ]
  }
}

Default Config

let DefaultModule = {
  loaders: [
    { test: /\.js$/, exclude: /node_modules/, loader: 'babel' }
  ]
}

let DefaultDevEnvSetting = {
  entry: './src/index.js',
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: './bundle.js',
    publicPath: 'build'
  },
  devtool: '#eval-source-map',
  module: DefaultModule
}
1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago