avet-build

raw JSON →
1.4.4 verified Sat Apr 25 auth: no javascript maintenance

avet-build is a build tool for avet, a framework for building server-rendered React applications. This package provides webpack build configurations used in the avet ecosystem. Version 1.4.4 is the latest stable release, with no recent updates since 2018. It is part of the avet monorepo and is designed to work with Node.js >= 8. Key differentiator: integrates with avet's build pipeline, handling webpack bundling for both client and server, and supports features like babel transpilation, static file serving, and environment variable injection. Unlike generic build tools, it is tightly coupled to avet's project structure.

error Error: Cannot find module 'webpack'
cause avet-build requires webpack as a peer dependency but it is not installed
fix
npm install webpack@3 --save-dev
error TypeError: build is not a function
cause Importing the module incorrectly, e.g., using require('avet-build').default without default export
fix
Use import build from 'avet-build'
error Error: No configuration found for webpack
cause avet-build expects a project structure with a 'build' directory or specific config files
fix
Ensure the project has the required avet structure (e.g., build/config/webpack.js)
error Module not found: Error: Can't resolve 'babel-loader'
cause babel-loader is not installed as a dependency
fix
npm install babel-loader@7 --save-dev
error Error: The provided value 'NODE_ENV' is not a valid environment
cause The 'env' option passed to build() is incorrect or missing
fix
Pass e.g., { env: 'production' } or set process.env.NODE_ENV accordingly
breaking NODE_ENV must be set to 'production' for optimized builds; otherwise development bundles are emitted
fix Set process.env.NODE_ENV = 'production' before calling build, or pass env option as 'production'.
gotcha avet-build uses webpack 3.x internally; incompatible with webpack 4+ plugins
fix Do not install webpack 4+ or plugins expecting webpack 4. Use only webpack 3 compatible loaders/plugins.
gotcha The package has not been updated since 2018; may have unpatched security vulnerabilities in transitive dependencies
fix Consider migrating to a maintained alternative or audit dependencies with npm audit.
deprecated The build function no longer accepts a callback; must return a promise
fix Use async/await or .then() instead of callback pattern.
breaking Minimum Node.js version is 8; Node.js 6 and below are not supported
fix Update Node.js to >=8 or use a compatible version.
gotcha Custom webpack config is merged via webpack-merge; deep merging may produce unexpected results for arrays
fix Ensure custom config arrays (e.g., plugins, loaders) are concatenated, not overridden.
npm install avet-build
yarn add avet-build
pnpm add avet-build

Demonstrates programmatic build using avet-build with async/await and error handling.

import build from 'avet-build';

async function start() {
  try {
    const result = await build({
      cwd: process.cwd(),
      env: process.env.NODE_ENV || 'production',
      analyze: false,
    });
    console.log('Build completed:', result);
  } catch (err) {
    console.error('Build failed:', err);
    process.exit(1);
  }
}

start();