webpack-tool
webpack build and webpack build result web view
Last updated 4 years ago by hubcarl .
MIT · Repository · Bugs · Original npm
$ cnpm install webpack-tool 
SYNC missed versions from official npm registry.

webpack-tool

Koa Webpack Dev Server:

  • development mode, start webpack koa server, file memory, hot update.

  • production mode, webpack build file to disk.

Version

  • webpack 5: webpack-tool: 5.x.x
  • webpack 4: webpack-tool: 4.x.x
  • webpack 3: webpack-tool: 3.x.x

Install

$ npm i webpack-tool --save

Usage

//build/index.js
const WebpackTool = require('webpack-tool');
const NODE_ENV = process.env.VIEW;

const webpackTool = new WebpackTool({
  devServer: {
    before: before => {
      // register koa middleware
    },
    after: app => {
      // register koa middleware
    },
    proxy: {
      '/api': {
        target: 'http://localhost:3000',
        pathRewrite: {'^/api' : ''}
      }
    },
    historyApiFallback: {
      index: '/app.html'
    }
  }
});

const webpackConfig = {
  entry:{
    index: './src/index.js'
  },
  module:{
    rules:[]
  }
  plugins: []
};

if (NODE_ENV === 'development') {
  // start webpack build and show build result ui view
  webpackTool.server(webpackConfig);
} else {
  // if you want to show build result ui view for build mode, please set  process.env.BUILD_VIEW=true
  webpackTool.build(webpackConfig);
}

Configuration

config.devServer support follow option:

Run

"scripts": {
  "start": "cross-env node build"
 }
npm start

Start Webpack Debug Server: http://127.0.0.1:8888/debug

UI-VIEW

Current Tags

  • 3.1.8                                ...           3.x (7 years ago)
  • 3.1.5                                ...           3x (7 years ago)
  • 5.0.4                                ...           5x (4 years ago)
  • 5.0.3                                ...           latest (4 years ago)
  • 4.4.1                                ...           next (7 years ago)

7 Versions

  • 5.0.3                                ...           4 years ago
  • 5.0.4                                ...           4 years ago
  • 4.5.4                                ...           5 years ago
  • 4.4.1                                ...           7 years ago
  • 3.1.5                                ...           7 years ago
  • 3.1.8                                ...           7 years ago
  • 4.5.3                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (15)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org