pobpack-node
Build and run node projects with webpack.
Last updated 2 months ago by churpeau .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pobpack-node 
SYNC missed versions from official npm registry.

pobpack-node

Build and run node projects with webpack.

Screenshot

hello-example

Features

  • Start without config
  • Hot Module Reload
  • Human readable errors
  • You can override everything in the webpack config

Install

npm install --save pobpack-node

Usage

package.json

{
  "scripts": {
    "build": "pobpack-node build",
    "start": "pobpack-node"
  }
}
npm run start

Configuration Options

You can create a file named createWebpackConfig.js next to package.json:

module.exports = function (config, options) {
  return config({
    ...options,
    babel: {}, // babel config (see below)
    jsLoaders: {}, // add more webpack loaders to js/jsx (see below)
    moduleRules: [], // add more webpack rules
    prependPlugins: [], // prepend plugins
    plugins: [], // append plugins
    paths: { src: 'src', build: 'build' },
  });
};

Hot Reload

You should read webpack documentation about HMR

You can activate accept hot-reload by default with webpack-module-hot-accept

npm install --save-dev webpack-module-hot-accept

createWebpackConfig.js

module.exports = function (config, options) {
  return config(Object.assign({}, options, {
    jsLoaders: [
      'webpack-module-hot-accept',
    ]
  }));
};

Configuration examples

module.exports = function (config, options) {
  return config(Object.assign({}, options, {
  }));
};

Add a webpack plugin

module.exports = function (config, options) {
  return config(Object.assign({}, options, {
    plugins: [new WebPackPlugin()],
  }));
};

You can also do:

module.exports = function (config, options) {
  config = config(options);
  config.plugins.push(new WebPackPlugin());
  return config;
};

Add a babel plugin

const babelPlugin = require('babel-plugin-example');

module.exports = function (config, options) {
  return config(Object.assign({}, options, {
    babel: {
      plugins: [babelPlugin]
    }
  }));
};

Override babel preset

const babelPlugin = require('babel-plugin-example');

module.exports = function (config, options) {
  return config(Object.assign({}, options, {
    babel: {
      presets: [
        'pobpack/babel',
        'stage-1',
      ]
    }
  }));
};

Add webpack loaders

pobpack handle json and js/jsx files

const babelPlugin = require('babel-plugin-example');

module.exports = function (config, options) {
  return config(Object.assign({}, options, {
    loaders: [
      // add your loaders
    ]
  }));
};

Add js/jsx loaders

const babelPlugin = require('babel-plugin-example');

module.exports = function (config, options) {
  return config(Object.assign({}, options, {
    jsLoaders: [
      // add your loaders
    ]
  }));
};

Alternatives

Current Tags

  • 8.0.3                                ...           latest (2 months ago)

71 Versions

  • 8.0.3                                ...           2 months ago
  • 8.0.2                                ...           2 months ago
  • 8.0.1                                ...           2 months ago
  • 8.0.0                                ...           2 months ago
  • 7.7.3                                ...           5 months ago
  • 7.7.2                                ...           5 months ago
  • 7.7.1                                ...           10 months ago
  • 7.7.0                                ...           10 months ago
  • 7.6.3                                ...           10 months ago
  • 7.6.2                                ...           10 months ago
  • 7.6.1                                ...           10 months ago
  • 7.6.0                                ...           10 months ago
  • 7.5.0                                ...           a year ago
  • 7.4.1                                ...           a year ago
  • 7.4.0                                ...           a year ago
  • 7.3.1                                ...           a year ago
  • 7.3.0                                ...           a year ago
  • 7.2.3                                ...           a year ago
  • 7.2.2                                ...           a year ago
  • 7.2.1                                ...           a year ago
  • 7.2.0                                ...           a year ago
  • 7.1.0                                ...           a year ago
  • 7.0.1                                ...           a year ago
  • 7.0.0                                ...           a year ago
  • 6.2.0                                ...           a year ago
  • 6.1.0                                ...           a year ago
  • 6.0.0                                ...           a year ago
  • 5.0.6                                ...           2 years ago
  • 5.0.5                                ...           2 years ago
  • 5.0.4                                ...           2 years ago
  • 5.0.3                                ...           2 years ago
  • 5.0.2                                ...           2 years ago
  • 5.0.1                                ...           2 years ago
  • 5.0.0                                ...           2 years ago
  • 4.1.4                                ...           2 years ago
  • 4.1.3                                ...           2 years ago
  • 4.1.2                                ...           2 years ago
  • 4.1.1                                ...           2 years ago
  • 4.1.0                                ...           2 years ago
  • 4.0.0                                ...           2 years ago
  • 3.2.1                                ...           2 years ago
  • 3.2.0                                ...           2 years ago
  • 3.1.3                                ...           2 years ago
  • 3.1.2                                ...           2 years ago
  • 3.1.1                                ...           2 years ago
  • 3.1.0                                ...           2 years ago
  • 3.0.3                                ...           2 years ago
  • 3.0.2                                ...           2 years ago
  • 3.0.1                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.8.1                                ...           3 years ago
  • 0.7.0                                ...           3 years ago
  • 0.6.0                                ...           3 years ago
  • 0.5.0                                ...           3 years ago
  • 0.4.2                                ...           3 years ago
  • 0.4.1                                ...           3 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.2                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 73
Last Day 0
Last Week 0
Last Month 0
Dependents (1)

Copyright 2014 - 2017 © taobao.org |