@reactway/webpack-builder
TypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

@reactway/webpack-builder

A tool to create webpack config easier using @reactway plugins.

Getting started

$ npm i @reactway/webpack-builder

To create a webpack config with builder first you have to create webpack.config.js and add import to it. You must define workspace directory and base configuration with entry and output fields to able use.

Example config

const webpackBuilder = require("@reactway/webpack-builder");

module.exports = new webpackBuilder.Builder(__dirname, {
    entry: "./src/app.js",
    output: {
        path: "./dist",
        filename: "[name].bundle.js"
    }
}).toConfig();

API

use() - Insert plugin to config. Possible to use more than one plugin.

const webpackBuilder = require("@reactway/webpack-builder");
const examplePlugin = require("@reactway/webpack-builder-example-plugin");
const examplePluginOther = require("@reactway/webpack-builder-example-plugin-other");

module.exports = new webpackBuilder.Builder(__dirname, {
    entry: "./src/app.js",
    output: {
        path: "./dist",
        filename: "[name].bundle.js"
    }
})
    .use(examplePlugin)
    .use(examplePluginOther)
    .toConfig();

update() - Update webpack config fields.

const webpackBuilder = require("@reactway/webpack-builder");

module.exports = new webpackBuilder.Builder(__dirname, {
    entry: "./src/app.js",
    output: {
        path: "./dist",
        filename: "[name].bundle.js"
    }
})
    .update(webpack => {
        webpack.mode = "production";
        return webpack;
    })
    .toConfig();

toConfig() - Returns webpack config to use. Required to generate configuration.

Documentation

WIP

License

Released under the MIT license.

Package Sidebar

Install

npm i @reactway/webpack-builder

Weekly Downloads

1

Version

2.0.4

License

MIT

Unpacked Size

12.6 kB

Total Files

7

Last publish

Collaborators

  • martynas-zilinskas
  • quatrodev
  • reactway-dev