@vrbo/nimbuild-webpack

1.0.0 • Public • Published

@vrbo/nimbuild-webpack

NPM Version Build Status

Library that provides nimbuild webpack bundling at runtime

Installation

npm install --save @vrbo/nimbuild-webpack

Usage

Import module and instantiate new class instance:

const webpacknimbuild = require('@vrbo/nimbuild-webpack')({
    webpackConfig: {...}, // customize webpack compiler
    maxEntries: 100 // defaults to 0 for infinity
});

Get bundle string:

async function getBundleString() {
    const response = await webpacknimbuild.run({
        entry: ['react', 'react-dom'],
        minify: true,
        modifyScript: (script) => {
            // Optionally wrap response
            return `!function (undefined) { 'use strict'; ${script} }();`;
        }
    });
    return response.script; // contains string value of bundle
}

Getting / Setting Cache:

// Get serialized cache
const serializedData = webpacknimbuild.serializeCache();

// Set cache from serialized data
webpacknimbuild.deserializeCache(serializedData);

Configure nimbuild-webpack to handle ES6+ source code

const webpacknimbuild = require('@vrbo/nimbuild-webpack')({
    webpackConfig: {
        module: {
            rules: [
                {
                    test: /\.js$/,
                    loader: 'babel-loader'
                }
            ]
        }
    }
});

Development

Starting development harness

npm start

Prettier

This projects supports auto-formatting of source code! Simply find your favorite IDE from the list in the following list: https://prettier.io/docs/en/editors.html

For VSCode support, perform the following steps:

  • Launch VS Code Quick Open (Ctrl+P)
  • Paste the following command, and press enter:
ext install esbenp.prettier-vscode

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.01latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.01
0.2.01
0.1.11
0.1.01
0.0.31
0.0.21
0.0.11

Package Sidebar

Install

npm i @vrbo/nimbuild-webpack

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

14.7 kB

Total Files

6

Last publish

Collaborators

  • expediagroup_oss
  • yosafat-eg
  • aarestrada
  • shellbj
  • tlivings
  • mcjfunk
  • tuckbick
  • codeburke
  • notethis
  • joonastanner
  • lasanthak