Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@reactway/webpack-builder

reactway675MIT2.0.4TypeScript support: included

A tool to create webpack config easier using plugins.

webpack, webpack-builder, config, plugins, tool, reactway

readme

@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.