@packmule/raw-pack
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

Raw Pack npm-latest

Merge raw webpack configuration.

Overview

Setup

Raw Pack is included in the default and complete editions.

Current Release

npm install --save-dev @packmule/raw-pack

Nightly Build

npm install --save-dev @packmule/raw-pack@nightly

API

Methods

RawPack(generate, process?)
Instantiate a new raw pack.

plugin(plugin: webpack.Plugin)
Add a webpack plugin.

Hints

View the packmule hints documentation for more information.

Raw pack doesn't use any hints directly but they're passed to the functions given to the constructor.

Usage

View the packmule API documentation for general usage patterns.

Basic Usage

Merge custom webpack configuration.

import Packmule from '@packmule/core';
import RawPack from '@packmule/raw-pack';

const packmule = new Packmule();
const pack = new RawPack((options, hints) => {
    return {
        cache: hints.cache,
    };
});

packmule.add(pack);

return packmule.generate();

Specific Hints

Set different/explicit hints for the raw pack.

import Packmule from '@packmule/core';
import RawPack from '@packmule/raw-pack';

const packmule = new Packmule();
const pack = new RawPack((options, hints) => {
    return {
        cache: hints.cache,
    };
});

packmule.add(pack, {
    cache: false,
});

return packmule.generate();

Register Plugin

Register a webpack plugin.

import webpack from 'webpack';
import Packmule from '@packmule/core';
import RawPack from '@packmule/raw-pack';

const plugin = new webpack.ProvidePlugin({
    $: 'jquery',
});

const packmule = new Packmule();
const pack = new RawPack().plugin(plugin);

packmule.add(pack);

return packmule.generate();

Process Configuration

Process the final webpack configuration.

import Packmule from '@packmule/core';
import RawPack from '@packmule/raw-pack';

const packmule = new Packmule();
const pack = new RawPack(
    () => {},
    (configuration, options, hints) => {
        configuration.cache = hints.cache;
        return configuration;
    },
);

packmule.add(pack);

return packmule.generate();

Internals

Dependencies

This dependencies are used primarily by the pack internally.

  • webpack-merge

License

MIT


Package Sidebar

Install

npm i @packmule/raw-pack

Weekly Downloads

1

Version

2.1.0

License

MIT

Unpacked Size

8.94 kB

Total Files

11

Last publish

Collaborators

  • t.esterer
  • thasmo