Socket
Book a DemoInstallSign in
Socket

@funboxteam/rebuild-in-progress-webpack-plugin

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@funboxteam/rebuild-in-progress-webpack-plugin

Creates the file indicator at the beginning of the build and deletes it at the end.

latest
Source
npmnpm
Version
4.1.0
Version published
Maintainers
4
Created
Source

@funboxteam/rebuild-in-progress-webpack-plugin

npm

Webpack plugin that creates the file indicator at the beginning of the build and deletes it at the end.

По-русски

Rationale

Sometimes external programs have to know the project building state. E.g. it's important to have this knowledge for tests running (especially E2E), because testing should be started when the project is completely built.

To solve this problem RebuildInProgress plugin was created. It creates the file node_modules/.rebuildInProgress when webpack starts to build the project and removes it at the end.

Usage

Add the plugin in plugins array as usual:

const RebuildInProgressPlugin = require('@funboxteam/rebuild-in-progress-webpack-plugin');

module.exports = {
  plugins: [
    new RebuildInProgressPlugin()
  ]
}

Set the path to the file if the default one isn't suitable:

const RebuildInProgressPlugin = require('@funboxteam/rebuild-in-progress-webpack-plugin');
const rebuildInProgressPath = 'node_modules/.alternativeName';

module.exports = {
  plugins: [
    new RebuildInProgressPlugin(rebuildInProgressPath)
  ]
}

Build state watching

Here's an example of watching for build state using fs:

const fs = require('fs');
const rebuildInProgressPath = 'node_modules/.rebuildInProgress';

fs.watch(path.dirname(rebuildInProgressPath), (eventType, filename) => {
  if (eventType === 'rename' && filename === path.basename(rebuildInProgressPath)) {
    if (fs.existsSync(rebuildInProgressPath)) {
      // Build has been started
    } else {
      // Build has been completed
    }
  }
});

Sponsored by FunBox

Keywords

webpack

FAQs

Package last updated on 03 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts